Overview | Package | Class | Use | Tree | Deprecated | Index | Help
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD

## org.mule.api.transformer
Interface Transformer

All Superinterfaces:
  Disposable, EndpointAware, Initialisable, MessageProcessor, MuleContextAware, NamedObject

All Known Subinterfaces:
  MessageTransformer

All Known Implementing Classes:
  AbstractCompressionTransformer, AbstractDiscoverableTransformer, AbstractEncryptionTransformer, AbstractEventTransformer, AbstractExpressionTransformer, AbstractJmsTransformer, AbstractJsonTransformer, AbstractMessageAwareTransformer, AbstractMessageTransformer, AbstractTransformer, AbstractXmlTransformer, AbstractXStreamTransformer, AddBookResponse, AnnotatedTransformerProxy, AtomEntryBuilderTransformer, AutoTransformer, Base64Decoder, Base64Encoder, BaseToOutputHandler, BeanBuilderTransformer, BeanToMap, ByteArrayToHexString, ByteArrayToMuleMessage, ByteArrayToObject, ByteArrayToSerializable, ChatStringToString, CreditProfileXmlToCreditProfile, DecryptionTransformer, DomDocumentToXml, EmailMessageToString, EncryptionTransformer, ErrorMessageToException, ErrorMessageToExceptionBean, ExceptionBeanToErrorMessage, ExceptionToString, ExpressionTransformer, FileToByteArray, FileToString, GetBeanProperty, GZipCompressTransformer, GZipUncompressTransformer, HexStringToByteArray, HttpClientMethodResponseToObject, HttpRequestBodyToParamMap, HttpRequestToBook, HttpRequestToByteArray, HttpRequestToInputStream, HttpRequestToNameString, HttpRequestToParameter, HttpRequestToParameterMap, HttpResponseToString, IPToSender, JAXBMarshallerTransformer, JAXBUnmarshallerTransformer, JMSMessageToObject, JsonToObject, JXPathExtractor, LoanQuoteRequestToCreditProfileArgs, MapLookup, MapToBean, MessagePropertiesTransformer, MimeMessageToRfc822ByteArray, MuleMessageToByteArray, MuleMessageToHttpResponse, NameStringToChatString, NoActionTransformer, ObjectArrayToString, ObjectToByteArray, ObjectToFeed, ObjectToHttpClientMethodRequest, ObjectToInputStream, ObjectToJMSMessage, ObjectToJson, ObjectToMimeMessage, ObjectToOutputHandler, ObjectToRemoteInvocationResultTransformer, ObjectToRemoteInvocationTransformer, ObjectToRssFeed, ObjectToString, ObjectToXml, ObjectToXmppPacket, OrderToEmailTransformer, RestRequestToCustomerRequest, Rfc822ByteArraytoMimeMessage, ScriptTransformer, SerializableToByteArray, ServletRequestToOutputHandler, SimpleMathTransformer, StdinToNameString, StringAppendTestTransformer, StringAppendTransformer, StringToEmailMessage, StringToNameString, StringToNumber, StringToObjectArray, TransformerChain, TransformerTemplate, ValidateResponse, XmlEntityDecoder, XmlEntityEncoder, XmlPrettyPrinter, XmlToDomDocument, XmlToObject, XmlToOutputHandler, XmlToXMLStreamReader, XmppPacketToObject, XPathExtractor, XQueryTransformer, XsltTransformer

    public interface Transformer

extends MessageProcessor, Initialisable, Disposable, NamedObject, MuleContextAware, EndpointAware

`Transformer` can be chained together to covert message payloads from one object type to another.

Field Summary

Fields inherited from interface org.mule.api.lifecycle.Initialisable
`PHASE_NAME`

Fields inherited from interface org.mule.api.lifecycle.Disposable
`PHASE_NAME`

Method Summary
`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. use `isSourceDataTypeSupported(org.mule.api.transformer.DataType)` instead
`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)` Thransforms the supplied data and returns the result
`Object` | `transform(Object src, String encoding)` Thransforms the supplied data and returns the result

Methods inherited from interface org.mule.api.processor.MessageProcessor
`process`

Methods inherited from interface org.mule.api.lifecycle.Initialisable
`initialise`

Methods inherited from interface org.mule.api.lifecycle.Disposable
`dispose`

Methods inherited from interface org.mule.api.NamedObject
`getName, setName`

Methods inherited from interface org.mule.api.context.MuleContextAware
`setMuleContext`

Methods inherited from interface org.mule.endpoint.EndpointAware
`setEndpoint`

Method Detail

### isSourceTypeSupported

    @Deprecated
    boolean isSourceTypeSupported(Class<?> aClass)

  Deprecated. use `isSourceDataTypeSupported(org.mule.api.transformer.DataType)` instead

  Determines if a particular source class can be handled by this transformer

  Parameters:
    `aClass` - The class to check for compatability
  Returns:
    true if the transformer supports this type of class or false otherwise

### isSourceDataTypeSupported

    boolean isSourceDataTypeSupported(DataType<?> dataType)

  Determines if a particular source class can be handled by this transformer

  Parameters:
    `dataType` - The DataType to check for compatability
  Returns:
    true if the transformer supports this type of class or false otherwise
  Since:
    3.0.0

### getSourceTypes

    @Deprecated
    List<Class<?>> getSourceTypes()

  Deprecated. use `getSourceDataTypes()` instead

  Returns an unmodifiable list of Source types registered on this transformer

  Returns:
    an unmodifiable list of Source types registered on this transformer

### getSourceDataTypes

    List<DataType<?>> getSourceDataTypes()

  Returns an unmodifiable list of Source types registered on this transformer

  Returns:
    an unmodifiable list of Source types registered on this transformer
  Since:
    3.0.0

### isAcceptNull

    boolean isAcceptNull()

  Does this transformer allow null input?

  Returns:
    true if this transformer can accept null input

### isIgnoreBadInput

    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. Since transformers are often chained, it is useful to be able to ignore a transformer in the chain and move to the next one.

  Returns:
    true if the transformer can be ignorred if the currnet source type is not supported, false if an exception should be throw due to an incompatible source type being passed in.

### transform

    Object transform(Object src)
                     throws TransformerException

  Thransforms the supplied data and returns the result

  Parameters:
    `src` - the data to transform
  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

    Object transform(Object src,
                     String encoding)
                     throws TransformerException

  Thransforms the supplied data and returns the result

  Parameters:
    `src` - the data to transform
    `encoding` - 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

### setReturnClass

    @Deprecated
    void setReturnClass(Class<?> theClass)

  Deprecated. use `setReturnDataType(DataType)` instead

  Sets the expected return type for the transformed data. If the transformed data is not of this class type a `TransformerException` will be thrown.

  Parameters:
    `theClass` - the expected return type class

### getReturnClass

    @Deprecated
    Class<?> getReturnClass()

  Deprecated. use `getReturnDataType()` instead.

  Specifies the Java type of the result after this transformer has been executed. Mule will use this to validate the return type but also allow users to perform automatic transformations based on the source type of the object to transform and this return type.

  Returns:
    the excepted return type from this transformer

### setReturnDataType

    void setReturnDataType(DataType<?> type)

  Sets the expected return type for the transformed data. If the transformed data is not of this class type a `TransformerException` will be thrown.

  This method superseeds `getReturnClass()` because it allows Generics information to be associated with the return type of the transformer

  Parameters:
    `type` - the expected return type for this transformer
  Since:
    3.0.0

### getReturnDataType

    DataType<?> getReturnDataType()

  Specifies the return type of the result after this transformer has been executed. Mule will use this to validate the return type but also allow users to perform automatic transformations based on the source type of the object to transform and this return type.

  This method superseeds `getReturnClass()` because it allows Generics information to be associated with the return type of the transformer

  Returns:
    the excepted return type for this transformer
  Since:
    3.0.0

### getMimeType

    String getMimeType()

  Return the mime type returned by the transformer (if any).

### getEncoding

    String getEncoding()

  Return the encoding returned by the transformer (if any).

### getEndpoint

    ImmutableEndpoint getEndpoint()

  Deprecated.

  The endpoint that this transformer is attached to

  Returns:
    the endpoint associated with the transformer

Overview | Package | Class | Use | Tree | Deprecated | Index | Help
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD

Copyright © 2003-2010 MuleSoft, Inc.. All Rights Reserved.