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}
BUILT, FAILED, INITIALIZED, INITIALIZING, lock, NEW, SHUTDOWN, SHUTTING_DOWN, 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, suspend
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
trySetCamelContext
getStatus, isRunAllowed, isStarted, isStarting, isStopped, isStopping, isSuspending
isSuspended, resume, suspend
shutdown
public abstract void transform(Message message, DataType from, DataType to) throws Exception
message
- message to apply transformationfrom
- 'from' data typeto
- 'to' data typeException
public 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()
CamelContextAware
CamelContext
getCamelContext
in interface CamelContextAware
public void setCamelContext(CamelContext context)
CamelContextAware
CamelContext
setCamelContext
in interface CamelContextAware
context
- the Camel contextprotected void doStart() throws Exception
BaseService
BaseService.doStop()
for more details.doStart
in class BaseService
Exception
BaseService.doStop()
protected void doStop() throws Exception
BaseService
BaseService.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 BaseService
Exception
BaseService.doStart()
Apache Camel