public abstract class Transformer extends ServiceSupport implements CamelContextAware
ContractAdvice looks for a required Transformer and apply if
input/output type declared on a route is different from current message type.ContractAdvice}
{@link DataType} {@link InputTypeDefinition} {@link OutputTypeDefinition}shutdown, shuttingdown, started, starting, stopped, stopping, suspended, suspending| Constructor and Description |
|---|
Transformer() |
| Modifier and Type | Method and Description |
|---|---|
protected void |
doStart()
Implementations override this method to support customized start/stop.
|
protected void |
doStop()
Implementations override this method to support customized start/stop.
|
CamelContext |
getCamelContext()
Get the
CamelContext |
DataType |
getFrom()
Get 'from' data type.
|
String |
getModel()
Get a data model which is supported by this transformer.
|
DataType |
getTo()
Get 'to' data type.
|
void |
setCamelContext(CamelContext context)
Injects the
CamelContext |
Transformer |
setFrom(String from)
Set 'from' data type.
|
Transformer |
setModel(String model)
Set data model.
|
Transformer |
setTo(String to)
Set 'to' data type.
|
String |
toString() |
abstract void |
transform(Message message,
DataType from,
DataType to)
Perform data transformation with specified from/to type.
|
doResume, doShutdown, doSuspend, getStatus, getVersion, isRunAllowed, isStarted, isStarting, isStopped, isStopping, isStoppingOrStopped, isSuspended, isSuspending, isSuspendingOrSuspended, resume, shutdown, start, stop, suspendpublic Transformer()
public abstract void transform(Message message, DataType from, DataType to) throws Exception
message - message to apply transformationfrom - 'from' data typeto - 'to' data typeExceptionpublic Transformer setModel(String model)
model - data modelpublic Transformer setFrom(String from)
from - 'from' data typepublic Transformer setTo(String to)
to - 'to' data typepublic CamelContext getCamelContext()
CamelContextAwareCamelContextgetCamelContext in interface CamelContextAwarepublic void setCamelContext(CamelContext context)
CamelContextAwareCamelContextsetCamelContext in interface CamelContextAwarecontext - the Camel contextprotected void doStart() throws Exception
ServiceSupportServiceSupport.doStop() for more details.doStart in class ServiceSupportExceptionServiceSupport.doStop()protected void doStop() throws Exception
ServiceSupportServiceSupport.doStop() method when
the service is being stopped. This method will also be invoked
if the service is still in uninitialized state (eg has not
been started). The method is always called to allow the service
to do custom logic when the service is being stopped, such as when
CamelContext is shutting down.doStop in class ServiceSupportExceptionServiceSupport.doStart()Apache Camel