public abstract class AbstractMessageTransformer extends AbstractTransformer implements MessageTransformer
AbstractMessageTransformer
is a transformer that has a reference
to the current message. This message can be used to obtain properties associated
with the current message which are useful to the transform. Note that when part of a
transform chain, the MuleMessage payload reflects the pre-transform message state,
unless there is no current event for this thread, then the message will be a new
DefaultMuleMessage with the src as its payload. Transformers should always work on the
src object not the message payload.MuleMessage
,
DefaultMuleMessage
encoding, endpoint, logger, mimeType, MULE_MESSAGE_DATA_TYPE, muleContext, name, returnType, sourceTypes
PHASE_NAME
PHASE_NAME
PROPERTY_NAME
Constructor and Description |
---|
AbstractMessageTransformer() |
Modifier and Type | Method and Description |
---|---|
protected Object |
checkReturnClass(Object object,
MuleEvent event)
Check if the return class is supported by this transformer
|
Object |
doTransform(Object src,
String enc)
Perform a non-message aware transform.
|
boolean |
isSourceDataTypeSupported(DataType<?> dataType,
boolean exactMatch)
Determines whether that data type passed in is supported by this transformer
|
Object |
transform(Object src,
MuleEvent event)
Thransforms the supplied data and returns the result
|
Object |
transform(Object src,
String enc)
Transform the message with no event specified.
|
Object |
transform(Object src,
String enc,
MuleEvent event)
Thransforms the supplied data and returns the result
|
abstract Object |
transformMessage(MuleMessage message,
String outputEncoding)
Transform the message
|
dispose, generateTransformerName, getEncoding, getEncoding, getEndpoint, getMimeType, getName, getReturnClass, getReturnDataType, getSourceDataTypes, getSourceTypes, initialise, isAcceptNull, isAllowNullReturn, isConsumed, isIgnoreBadInput, isSourceDataTypeSupported, isSourceTypeSupported, isSourceTypeSupported, process, registerSourceType, registerSourceType, setAllowNullReturn, setEncoding, setEndpoint, setIgnoreBadInput, setMimeType, setMuleContext, setName, setReturnClass, setReturnDataType, toString, transform, unregisterSourceType, unregisterSourceType
getAnnotation, getAnnotations, setAnnotations
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
getEncoding, getEndpoint, getMimeType, getReturnClass, getReturnDataType, getSourceDataTypes, getSourceTypes, isAcceptNull, isIgnoreBadInput, isSourceDataTypeSupported, isSourceTypeSupported, setReturnClass, setReturnDataType, transform
process
initialise
dispose
setName
getName
setMuleContext
setEndpoint
public boolean isSourceDataTypeSupported(DataType<?> dataType, boolean exactMatch)
AbstractTransformer
isSourceDataTypeSupported
in class AbstractTransformer
dataType
- the type to check againstexactMatch
- if set to true, this method will look for an exact match to
the data type, if false it will look for a compatible data type.public final Object doTransform(Object src, String enc) throws TransformerException
doTransform
in class AbstractTransformer
TransformerException
public final Object transform(Object src, String enc) throws TransformerException
transform
in interface Transformer
transform
in class AbstractTransformer
src
- the data to transformenc
- 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 datapublic Object transform(Object src, MuleEvent event) throws TransformerMessagingException
MessageTransformer
transform
in interface MessageTransformer
src
- the data to transformevent
- the event currently being processedTransformerMessagingException
- if a error occurs transforming the data or if the
expected returnClass isn't the same as the transformed datapublic final Object transform(Object src, String enc, MuleEvent event) throws TransformerMessagingException
MessageTransformer
transform
in interface MessageTransformer
src
- the data to transformenc
- 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 encodingevent
- the event currently being processedTransformerMessagingException
- if a error occurs transforming the data or if the
expected returnClass isn't the same as the transformed dataprotected Object checkReturnClass(Object object, MuleEvent event) throws TransformerMessagingException
TransformerMessagingException
public abstract Object transformMessage(MuleMessage message, String outputEncoding) throws TransformerException
TransformerException
Copyright © 2003–2016 MuleSoft, Inc.. All rights reserved.