@NoExtend public class DefaultTransformationService extends Object implements TransformationService
Message
but decoupled from Message.
TODO Redefine this interface as part of Mule 4.0 transformation improvements (MULE-9141)Modifier and Type | Field and Description |
---|---|
protected MuleContext |
muleContext |
Constructor and Description |
---|
DefaultTransformationService(MuleContext muleContext) |
Modifier and Type | Method and Description |
---|---|
protected void |
checkResultDataType(Message message,
DataType resultType,
Object value) |
protected <T> T |
getPayload(Message message,
DataType resultType,
Charset encoding)
Attempts to obtain the payload of this message with the desired Class type.
|
protected Charset |
resolveEncoding(Message message) |
Message |
transform(Message message,
DataType outputDataType)
Attempts to obtain the payload of this message with the desired Class type.
|
Object |
transform(Object value,
DataType valueDataType,
DataType expectedDataType)
Given a value) it will try to transform it to the expected type defined in the {@code expectedDataType}
|
protected MuleContext muleContext
@Inject public DefaultTransformationService(MuleContext muleContext)
protected <T> T getPayload(Message message, DataType resultType, Charset encoding) throws MessageTransformerException
resultType
- the desired return typeencoding
- the encoding to use if requiredInputStream
in which case the stream will be read and the payload will become the fully
read stream.MessageTransformerException
- if a transformer cannot be found or there is an error during transformation of the payload.protected void checkResultDataType(Message message, DataType resultType, Object value) throws MessageTransformerException
MessageTransformerException
public Object transform(Object value, DataType valueDataType, DataType expectedDataType)
TransformationService
transform
in interface TransformationService
value
- the value to transformvalueDataType
- the value's DataType
expectedDataType
- the expected type's DataType
public Message transform(Message message, DataType outputDataType)
TransformationService
transform
in interface TransformationService
message
- the message to transformoutputDataType
- the desired return typeCopyright © 2018. All rights reserved.