org.mule.transformer
Class AbstractMessageTransformer
java.lang.Object
org.mule.transformer.AbstractTransformer
org.mule.transformer.AbstractMessageTransformer
- All Implemented Interfaces:
- AnnotatedObject, MuleContextAware, Disposable, Initialisable, NameableObject, NamedObject, MessageProcessor, MessageTransformer, Transformer, EndpointAware
- Direct Known Subclasses:
- AbstractAddVariablePropertyTransformer, AbstractExpressionTransformer, AbstractJmsTransformer, AbstractJsonTransformer, AbstractMessageAwareTransformer, AbstractRemoveVariablePropertyTransformer, AbstractXmlTransformer, AbstractXStreamTransformer, AddAttachmentTransformer, AnnotatedTransformerProxy, AutoTransformer, CopyAttachmentsTransformer, CopyPropertiesTransformer, FormTransformer, HttpRequestBodyToParamMap, HttpRequestToBook, HttpRequestToParameter, HttpRequestToParameterMap, MessagePropertiesTransformer, MuleMessageToByteArray, MuleMessageToHttpResponse, ObjectToHttpClientMethodRequest, ObjectToXmppPacket, OrderToEmailTransformer, ParseTemplateTransformer, RemoveAttachmentTransformer, RestRequestToCustomerRequest, ScriptTransformer, ServletTransformer, SetPayloadTransformer, StringToEmailMessage, TransformerChain, TransformerTemplate, XmppPacketToObject
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.
- See Also:
MuleMessage
,
DefaultMuleMessage
Methods inherited from class org.mule.transformer.AbstractTransformer |
dispose, generateTransformerName, getAnnotation, getAnnotations, getEncoding, getEncoding, getEndpoint, getMimeType, getName, getReturnClass, getReturnDataType, getSourceDataTypes, getSourceTypes, initialise, isAcceptNull, isAllowNullReturn, isConsumed, isIgnoreBadInput, isSourceDataTypeSupported, isSourceTypeSupported, isSourceTypeSupported, process, registerSourceType, registerSourceType, setAllowNullReturn, setAnnotations, setEncoding, setEndpoint, setIgnoreBadInput, setMimeType, setMuleContext, setName, setReturnClass, setReturnDataType, toString, transform, unregisterSourceType, unregisterSourceType |
Methods inherited from interface org.mule.api.transformer.Transformer |
getEncoding, getEndpoint, getMimeType, getReturnClass, getReturnDataType, getSourceDataTypes, getSourceTypes, isAcceptNull, isIgnoreBadInput, isSourceDataTypeSupported, isSourceTypeSupported, setReturnClass, setReturnDataType, transform |
AbstractMessageTransformer
public AbstractMessageTransformer()
isSourceDataTypeSupported
public boolean isSourceDataTypeSupported(DataType<?> dataType,
boolean exactMatch)
- Description copied from class:
AbstractTransformer
- Determines whether that data type passed in is supported by this transformer
- Overrides:
isSourceDataTypeSupported
in class AbstractTransformer
- Parameters:
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.
- Returns:
- whether the data type is supported
doTransform
public final Object doTransform(Object src,
String enc)
throws TransformerException
- Perform a non-message aware transform. This should never be called
- Specified by:
doTransform
in class AbstractTransformer
- Throws:
TransformerException
transform
public final Object transform(Object src,
String enc)
throws TransformerException
- Transform the message with no event specified.
- Specified by:
transform
in interface Transformer
- Overrides:
transform
in class AbstractTransformer
- Parameters:
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 encoding
- Returns:
- the transformed data
- Throws:
TransformerException
- if a error occurs transforming the data or if the
expected returnClass isn't the same as the transformed data
transform
public Object transform(Object src,
MuleEvent event)
throws TransformerMessagingException
- Description copied from interface:
MessageTransformer
- Thransforms the supplied data and returns the result
- Specified by:
transform
in interface MessageTransformer
- Parameters:
src
- the data to transformevent
- the event currently being processed
- Returns:
- the transformed data
- Throws:
TransformerMessagingException
- if a error occurs transforming the data or if the
expected returnClass isn't the same as the transformed data
transform
public final Object transform(Object src,
String enc,
MuleEvent event)
throws TransformerMessagingException
- Description copied from interface:
MessageTransformer
- Thransforms the supplied data and returns the result
- Specified by:
transform
in interface MessageTransformer
- Parameters:
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 processed
- Returns:
- the transformed data
- Throws:
TransformerMessagingException
- if a error occurs transforming the data or if the
expected returnClass isn't the same as the transformed data
checkReturnClass
protected Object checkReturnClass(Object object,
MuleEvent event)
throws TransformerMessagingException
- Check if the return class is supported by this transformer
- Throws:
TransformerMessagingException
transformMessage
public abstract Object transformMessage(MuleMessage message,
String outputEncoding)
throws TransformerException
- Transform the message
- Throws:
TransformerException
Copyright © 2003-2012 MuleSoft, Inc.. All Rights Reserved.