Package org.apache.camel.builder
Class TransformerBuilder
- java.lang.Object
-
- org.apache.camel.builder.TransformerBuilder
-
public class TransformerBuilder extends Object
A Java DSL which is used to build aTransformerand register intoCamelContext. It requires 'scheme' or a pair of 'from' and 'to' to be specified by scheme(), from() and to() method. And then you can choose a type of transformer by withUri(), withDataFormat(), withJava() or withBean() method.
-
-
Constructor Summary
Constructors Constructor Description TransformerBuilder()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description voidconfigure(org.apache.camel.CamelContext camelContext)Configure a Transformer according to the configurations built on this builder and register it into givenCamelContext.TransformerBuilderfromType(Class<?> from)Set the 'from' data type using Java class.TransformerBuilderfromType(String from)Set the 'from' data type name.TransformerBuilderscheme(String scheme)Set the scheme name supported by the transformer.TransformerBuildertoType(Class<?> to)Set the 'to' data type using Java class.TransformerBuildertoType(String to)Set the 'to' data type name.TransformerBuilderwithBean(String ref)Set the Java Bean name to be used for customTransformer.TransformerBuilderwithDataFormat(DataFormatDefinition dataFormatDefinition)Set theDataFormatDefinitionto be used for theDataFormatTransformer.TransformerBuilderwithJava(Class<? extends org.apache.camel.spi.Transformer> clazz)Set the JavaClassrepresents a customTransformerimplementation class.TransformerBuilderwithUri(String uri)Set the URI to be used for the endpointTransformer.
-
-
-
Method Detail
-
scheme
public TransformerBuilder scheme(String scheme)
Set the scheme name supported by the transformer. If you specify 'csv', the transformer will be picked up for all of 'csv' from/to Java transformation. Note that the scheme matching is performed only when no exactly matched transformer exists.- Parameters:
scheme- scheme name
-
fromType
public TransformerBuilder fromType(String from)
Set the 'from' data type name. If you specify 'xml:XYZ', the transformer will be picked up if source type is 'xml:XYZ'. If you specify just 'xml', the transformer matches with all of 'xml' source type like 'xml:ABC' or 'xml:DEF'.- Parameters:
from- 'from' data type name
-
fromType
public TransformerBuilder fromType(Class<?> from)
Set the 'from' data type using Java class.- Parameters:
from- 'from' Java class
-
toType
public TransformerBuilder toType(String to)
Set the 'to' data type name. If you specify 'json:XYZ', the transformer will be picked up if destination type is 'json:XYZ'. If you specify just 'json', the transformer matches with all of 'json' destination type like 'json:ABC' or 'json:DEF'.- Parameters:
to- 'to' data type
-
toType
public TransformerBuilder toType(Class<?> to)
Set the 'to' data type using Java class.- Parameters:
to- 'to' Java class
-
withUri
public TransformerBuilder withUri(String uri)
Set the URI to be used for the endpointTransformer.- Parameters:
uri- endpoint URI
-
withDataFormat
public TransformerBuilder withDataFormat(DataFormatDefinition dataFormatDefinition)
Set theDataFormatDefinitionto be used for theDataFormatTransformer.
-
withJava
public TransformerBuilder withJava(Class<? extends org.apache.camel.spi.Transformer> clazz)
Set the JavaClassrepresents a customTransformerimplementation class.
-
withBean
public TransformerBuilder withBean(String ref)
Set the Java Bean name to be used for customTransformer.
-
configure
public void configure(org.apache.camel.CamelContext camelContext)
Configure a Transformer according to the configurations built on this builder and register it into givenCamelContext.- Parameters:
camelContext-CamelContext
-
-