public class ContractAdvice extends Object implements org.apache.camel.spi.CamelInternalProcessorAdvice
CamelInternalProcessorAdvice
which applies Transformer
and Validator
according to the data type Contract.
The default camel Message
implements DataTypeAware
which
holds a DataType
to indicate current message type. If the input type
declared by org.apache.camel.model.InputTypeDefinition
is different from current IN message type,
camel internal processor look for a Transformer which transforms from the current
message type to the expected message type before routing.
After routing, if the output type declared by org.apache.camel.model.OutputTypeDefinition
is different
from current OUT message (or IN message if no OUT), camel look for a Transformer and apply.Transformer
,
Validator
,
org.apache.camel.model.InputTypeDefinition
,
org.apache.camel.model.OutputTypeDefinition
Constructor and Description |
---|
ContractAdvice(org.apache.camel.spi.Contract contract) |
Modifier and Type | Method and Description |
---|---|
void |
after(org.apache.camel.Exchange exchange,
Object data) |
Object |
before(org.apache.camel.Exchange exchange) |
boolean |
hasState() |
public Object before(org.apache.camel.Exchange exchange) throws Exception
before
in interface org.apache.camel.spi.CamelInternalProcessorAdvice
Exception
public void after(org.apache.camel.Exchange exchange, Object data) throws Exception
after
in interface org.apache.camel.spi.CamelInternalProcessorAdvice
Exception
public boolean hasState()
hasState
in interface org.apache.camel.spi.CamelInternalProcessorAdvice
Apache Camel