Class TransformerDefinition
java.lang.Object
org.apache.camel.model.transformer.TransformerDefinition
- Direct Known Subclasses:
CustomTransformerDefinition
,DataFormatTransformerDefinition
,EndpointTransformerDefinition
Represents a
Transformer
which declarative transforms message content according to the
input type declared by InputTypeDefinition
and/or output type declared by OutputTypeDefinition
.
If you specify from='java:com.example.ABC' and to='xml:XYZ', the transformer will be picked up when current message
type is 'java:com.example.ABC' and expected message type is 'xml:XYZ'. If you specify from='java' to='xml', then it
will be picked up for all of Java to xml transformation. Also it's possible to specify scheme='xml' so that the
transformer will be picked up for all of Java to xml and xml to java transformation.-
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptionvoid
setFromType
(Class<?> clazz) Set the 'from' data type using Java class.void
setFromType
(String from) Set the 'from' data type name.void
Set a scheme name supported by the transformer.void
Set the 'to' data type using Java class.void
Set the 'to' data type name.
-
Constructor Details
-
TransformerDefinition
public TransformerDefinition()
-
-
Method Details
-
getScheme
-
setScheme
Set a 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
-
getFromType
-
setFromType
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
-
setFromType
Set the 'from' data type using Java class.- Parameters:
clazz
- 'from' Java class
-
getToType
-
setToType
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 name
-
setToType
Set the 'to' data type using Java class.- Parameters:
clazz
- 'to' Java class
-