public interface Transformer extends MessageProcessor, Initialisable, Disposable, NameableObject, MuleContextAware, EndpointAware
Transformer can be chained together to covert message payloads
from one object type to another.PHASE_NAMEPHASE_NAME| Modifier and Type | Method and Description |
|---|---|
String |
getEncoding()
Return the encoding returned by the transformer (if any).
|
ImmutableEndpoint |
getEndpoint()
Deprecated.
|
String |
getMimeType()
Return the mime type returned by the transformer (if any).
|
Class<?> |
getReturnClass()
Deprecated.
use
getReturnDataType() instead. |
DataType<?> |
getReturnDataType()
Specifies the return type of the result after this transformer has been executed.
|
List<DataType<?>> |
getSourceDataTypes()
Returns an unmodifiable list of Source types registered on this transformer
|
List<Class<?>> |
getSourceTypes()
Deprecated.
use
getSourceDataTypes() instead |
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(DataType<?> dataType)
Determines if a particular source class can be handled by this transformer
|
boolean |
isSourceTypeSupported(Class<?> aClass)
Deprecated.
|
void |
setReturnClass(Class<?> theClass)
Deprecated.
use
setReturnDataType(DataType) instead |
void |
setReturnDataType(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,
String encoding)
Transforms the supplied data and returns the result
|
processinitialisedisposesetNamegetNamesetMuleContextsetEndpoint@Deprecated boolean isSourceTypeSupported(Class<?> aClass)
isSourceDataTypeSupported(org.mule.api.transformer.DataType) insteadaClass - The class to check for compatibilityboolean isSourceDataTypeSupported(DataType<?> dataType)
dataType - The DataType to check for compatibility@Deprecated List<Class<?>> getSourceTypes()
getSourceDataTypes() insteadList<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, String 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 data@Deprecated void setReturnClass(Class<?> theClass)
setReturnDataType(DataType) insteadTransformerException will be
thrown.theClass - the expected return type class@Deprecated Class<?> getReturnClass()
getReturnDataType() instead.void setReturnDataType(DataType<?> type)
TransformerException will be
thrown.
This method supersedes getReturnClass() because it allows Generics information to be associated with the
return type of the transformertype - the expected return type for this transformerDataType<?> getReturnDataType()
getReturnClass() because it allows Generics information to be associated with the
return type of the transformerString getMimeType()
String getEncoding()
ImmutableEndpoint getEndpoint()
Copyright © 2003–2015 MuleSoft, Inc.. All rights reserved.