public interface Transformer extends Processor, org.mule.runtime.api.lifecycle.Initialisable, org.mule.runtime.api.lifecycle.Disposable, org.mule.runtime.api.meta.NameableObject, MuleContextAware
Transformer can be chained together to covert message payloads from one object type to another.ReactiveProcessor.ProcessingType| Modifier and Type | Method and Description |
|---|---|
default ReactiveProcessor.ProcessingType |
getProcessingType()
In order for Mule to determine the best way to execute different processors based on the chosen
ProcessingStrategy it
needs to know the type of work the message processor will be performing and if it is ReactiveProcessor.ProcessingType.BLOCKING,
ReactiveProcessor.ProcessingType.CPU_INTENSIVE intensive or neither (ReactiveProcessor.ProcessingType.CPU_LITE). |
org.mule.runtime.api.metadata.DataType |
getReturnDataType()
Specifies the return type of the result after this transformer has been executed.
|
List<org.mule.runtime.api.metadata.DataType> |
getSourceDataTypes()
Returns an unmodifiable list of Source types registered on this transformer
|
boolean |
isAcceptNull()
Does this transformer allow null input?
|
boolean |
isIgnoreBadInput()
By default, Mule will throw an exception if a transformer is invoked with a source object that is not compatible with the
transformer.
|
boolean |
isSourceDataTypeSupported(org.mule.runtime.api.metadata.DataType dataType)
Determines if a particular source class can be handled by this transformer
|
void |
setReturnDataType(org.mule.runtime.api.metadata.DataType type)
Sets the expected return type for the transformed data.
|
Object |
transform(Object src)
Transforms the supplied data and returns the result
|
Object |
transform(Object src,
Charset encoding)
Transforms the supplied data and returns the result
|
setMuleContextboolean isSourceDataTypeSupported(org.mule.runtime.api.metadata.DataType dataType)
dataType - The DataType to check for compatibilityList<org.mule.runtime.api.metadata.DataType> getSourceDataTypes()
boolean isAcceptNull()
boolean isIgnoreBadInput()
Object transform(Object src) throws TransformerException
src - the data to transformTransformerException - if a error occurs transforming the data or if the expected returnClass isn't the same as the
transformed dataObject transform(Object src, Charset encoding) throws TransformerException
src - the data to transformencoding - the encoding to use by this transformer. many transformations will not need encoding unless dealing with text
so you only need to use this method if yo wish to customize the encodingTransformerException - if a error occurs transforming the data or if the expected returnClass isn't the same as the
transformed datavoid setReturnDataType(org.mule.runtime.api.metadata.DataType type)
TransformerException will be thrown.type - the expected return type for this transformerorg.mule.runtime.api.metadata.DataType getReturnDataType()
default ReactiveProcessor.ProcessingType getProcessingType()
ReactiveProcessorProcessingStrategy it
needs to know the type of work the message processor will be performing and if it is ReactiveProcessor.ProcessingType.BLOCKING,
ReactiveProcessor.ProcessingType.CPU_INTENSIVE intensive or neither (ReactiveProcessor.ProcessingType.CPU_LITE).getProcessingType in interface ReactiveProcessorCopyright © 2003–2017 MuleSoft, Inc.. All rights reserved.