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 TypeMethodDescriptionvoid
configure
(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 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 theDataFormatDefinition
to be used for theDataFormat
Transformer
.Set the JavaClass
represents a customTransformer
implementation class.Set the URI to be used for the endpointTransformer
.
-
Constructor Details
-
TransformerBuilder
public TransformerBuilder()
-
-
Method Details
-
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 theDataFormatDefinition
to be used for theDataFormat
Transformer
. -
withJava
Set the JavaClass
represents a customTransformer
implementation class. -
withBean
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
-