public abstract class Transformer extends ServiceSupport implements CamelContextAware
org.apache.camel.processor.ContractAdvice looks for a required Transformer and apply if
input/output type declared on a route is different from current message type.org.apache.camel.processor.ContractAdvice}
{@link DataType} {@link org.apache.camel.model.InputTypeDefinition} {@link org.apache.camel.model.OutputTypeDefinition}BUILDED, FAILED, INITIALIZED, INITIALIZING, lock, NEW, SHUTDOWN, SHUTTINGDOWN, STARTED, STARTING, status, 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.
|
build, doBuild, doFail, doInit, doLifecycleChange, doResume, doShutdown, doSuspend, fail, getStatus, init, isBuild, isInit, isNew, isRunAllowed, isShutdown, isStarted, isStarting, isStartingOrStarted, isStopped, isStopping, isStoppingOrStopped, isSuspended, isSuspending, isSuspendingOrSuspended, resume, shutdown, start, stop, suspendclone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, waittrySetCamelContextgetStatus, isRunAllowed, isStarted, isStarting, isStopped, isStopping, isSuspendingisSuspended, resume, suspendshutdownpublic abstract void transform(Message message, DataType from, DataType to) throws Exception
message - message to apply transformationfrom - 'from' data typeto - 'to' data typeExceptionpublic String getModel()
public DataType getFrom()
public DataType getTo()
public 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
BaseServiceBaseService.doStop() for more details.doStart in class BaseServiceExceptionBaseService.doStop()protected void doStop()
throws Exception
BaseServiceBaseService.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 BaseServiceExceptionBaseService.doStart()Apache Camel