@Metadata(label="transformation") public abstract class TransformerDefinition extends Object
Represents a Transformer which declaratively 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.
Transformer
InputTypeDefinition
OutputTypeDefinition| Constructor and Description |
|---|
TransformerDefinition() |
| Modifier and Type | Method and Description |
|---|---|
Transformer |
createTransformer(CamelContext context) |
protected abstract Transformer |
doCreateTransformer(CamelContext context) |
String |
getFromType() |
String |
getScheme() |
String |
getToType() |
void |
setFromType(Class<?> clazz)
Set the 'from' data type using Java class.
|
void |
setFromType(String from)
Set the 'from' data type name.
|
void |
setScheme(String scheme)
Set a scheme name supported by the transformer.
|
void |
setToType(Class<?> clazz)
Set the 'to' data type using Java class.
|
void |
setToType(String to)
Set the 'to' data type name.
|
public TransformerDefinition()
public Transformer createTransformer(CamelContext context) throws Exception
Exceptionprotected abstract Transformer doCreateTransformer(CamelContext context) throws Exception
Exceptionpublic void setScheme(String scheme)
scheme - scheme namepublic String getFromType()
public void setFromType(String from)
from - 'from' data type namepublic void setFromType(Class<?> clazz)
clazz - 'from' Java classpublic void setToType(String to)
to - 'to' data type nameApache Camel