Package org.apache.camel.builder
Class TransformerBuilder
java.lang.Object
org.apache.camel.builder.TransformerBuilder
A Java DSL which is used to build a
Transformer and register into CamelContext. 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 -
Method Summary
Modifier and TypeMethodDescriptionvoidconfigure(org.apache.camel.CamelContext camelContext) Configure a Transformer according to the configurations built on this builder and register it into givenCamelContext.Set the 'from' data type using Java class.Set the 'from' data type name.Set the transformer name under which the transformer gets referenced when specifying the input/output data type on routes.Set the classpath location to scan forTransformerimplementations.Set the scheme name supported by the transformer.Set the 'to' data type using Java class.Set the 'to' data type name.Set the Java Bean name to be used for customTransformer.withDataFormat(DataFormatDefinition dataFormatDefinition) Set theDataFormatDefinitionto be used for theDataFormatTransformer.Enables default transformers on the registry.Set the JavaClassrepresents a customTransformerimplementation class.Set the URI to be used for the endpointTransformer.
-
Constructor Details
-
TransformerBuilder
public TransformerBuilder()
-
-
Method Details
-
name
Set the transformer name under which the transformer gets referenced when specifying the input/output data type on routes. If you specify a transformer name that matches a data type scheme like '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:
name- transformer name
-
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
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
Set the 'from' data type using Java class.- Parameters:
from- 'from' Java class
-
toType
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
Set the 'to' data type using Java class.- Parameters:
to- 'to' Java class
-
withUri
Set the URI to be used for the endpointTransformer.- Parameters:
uri- endpoint URI
-
withDataFormat
Set theDataFormatDefinitionto be used for theDataFormatTransformer. -
withJava
Set the JavaClassrepresents a customTransformerimplementation class. -
withBean
Set the Java Bean name to be used for customTransformer. -
withDefaults
Enables default transformers on the registry. -
scan
Set the classpath location to scan forTransformerimplementations. Usually these transformer implementations useDataTypeTransformerannotations to expose a transformer name and supported from/to data types. -
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
-