AbstractTransformer (Mule ESB 2.2.1 API)
Keywords: org.mule.transformer.AbstractTransformer class

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.transformer
Class AbstractTransformer

    java.lang.Object
      org.mule.transformer.AbstractTransformer

All Implemented Interfaces:
  Initialisable, NamedObject, BaseTransformer, Transformer

Direct Known Subclasses:
  AbstractCompressionTransformer, AbstractDiscoverableTransformer, AbstractEncryptionTransformer, AbstractEventTransformer, AbstractMessageAwareTransformer, AbstractXmlTransformer, AddBookResponse, Base64Decoder, Base64Encoder, ByteArrayToHexString, ByteArrayToSerializable, ChatStringToString, CreditProfileXmlToCreditProfile, EmailMessageToString, ErrorMessageToException, ErrorMessageToExceptionBean, ExceptionBeanToErrorMessage, ExceptionToString, GetBeanProperty, HexStringToByteArray, HttpClientMethodResponseToObject, HttpRequestToNameString, HttpResponseToString, JXPathExtractor, LoanQuoteRequestToCreditProfileArgs, MapLookup, MimeMessageToRfc822ByteArray, NameStringToChatString, NoActionTransformer, ObjectArrayToString, ObjectToOutputHandler, ObjectToRemoteInvocationResultTransformer, ObjectToRemoteInvocationTransformer, ObjectToString, OrderToEmailTransformer, ParameterMapToBook, Rfc822ByteArraytoMimeMessage, SerializableToByteArray, ServletRequestToOutputHandler, SimpleMathTransformer, StdinToNameString, StringAppendTransformer, StringToNameString, StringToNumber, StringToObjectArray, XmlEntityDecoder, XmlEntityEncoder, XmlPrettyPrinter, XPathExtractor

    public abstract class AbstractTransformer

extends Object
implements Transformer

`AbstractTransformer` is a base class for all transformers. Transformations transform one object into another.

Field Summary
`protected static int` | `DEFAULT_TRUNCATE_LENGTH`
`protected ImmutableEndpoint` | `endpoint` The endpoint that this transformer instance is configured on
`protected Log` | `logger`
`protected String` | `name` The name that identifies this transformer.
`protected Class` | `returnClass` The return type that will be returned by the `transform(java.lang.Object)` method is called
`protected List` | `sourceTypes` A list of supported Class types that the source payload passed into this transformer

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

Constructor Summary
`AbstractTransformer()` default constructor required for discovery

Method Summary
`protected Object` | `checkReturnClass(Object object)`
`protected abstract Object` | `doTransform(Object src, String encoding)`
`protected String` | `generateTransformerName()`
`ImmutableEndpoint` | `getEndpoint()` The endpoint that this transformer is attached to
`String` | `getName()` Gets the name of the object
`Class` | `getReturnClass()`
`List` | `getSourceTypes()` Returns an unmodifiable list of Source types registered on this transformer
`void` | `initialise()` Template method where deriving classes can do any initialisation after the properties have been set on this transformer
`boolean` | `isAcceptNull()` Does this transformer allow null input?
`protected boolean` | `isConsumed(Class srcCls)`
`boolean` | `isIgnoreBadInput()`
`boolean` | `isSourceTypeSupported(Class aClass)` Determines if a particular source class can be handled by this transformer
`boolean` | `isSourceTypeSupported(Class aClass, boolean exactMatch)`
`protected void` | `registerSourceType(Class aClass)`
`void` | `setEndpoint(ImmutableEndpoint endpoint)` Sets the endpoint associated with with this connector.
`void` | `setIgnoreBadInput(boolean ignoreBadInput)`
`void` | `setName(String string)` Sets the name of the object
`void` | `setReturnClass(Class newClass)` Sets the expected return type for the transformed data.
`String` | `toString()`
`Object` | `transform(Object src)` Transforms the object.
`protected void` | `unregisterSourceType(Class aClass)`

Methods inherited from class java.lang.Object
`clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait`

Field Detail

### DEFAULT_TRUNCATE_LENGTH

    protected static final int DEFAULT_TRUNCATE_LENGTH

See Also:
  Constant Field Values

### logger

    protected final Log logger

### returnClass

    protected Class returnClass

  The return type that will be returned by the `transform(java.lang.Object)` method is called

### name

    protected String name

  The name that identifies this transformer. If none is set the class name of the transformer is used

### endpoint

    protected ImmutableEndpoint endpoint

  The endpoint that this transformer instance is configured on

### sourceTypes

    protected final List sourceTypes

  A list of supported Class types that the source payload passed into this transformer

Constructor Detail

### AbstractTransformer

    public AbstractTransformer()

  default constructor required for discovery

Method Detail

### checkReturnClass

    protected Object checkReturnClass(Object object)
                               throws TransformerException

  Throws:
    `TransformerException`

### registerSourceType

    protected void registerSourceType(Class aClass)

### unregisterSourceType

    protected void unregisterSourceType(Class aClass)

### getName

    public String getName()

  Description copied from interface: `NamedObject`
  Gets the name of the object

  Specified by:
    `getName` in interface `NamedObject`
  Returns:
    transformer name

### setName

    public void setName(String string)

  Description copied from interface: `NamedObject`
  Sets the name of the object

  Specified by:
    `setName` in interface `NamedObject`
  Parameters:
    `string` -

### getReturnClass

    public Class getReturnClass()

  Specified by:
    `getReturnClass` in interface `Transformer`
  Returns:
    the exceptedreturn type

### setReturnClass

    public void setReturnClass(Class newClass)

  Description copied from interface: `Transformer`
  Sets the expected return type for the transformed data. If the transformed data is not of this class type a `TransformerException` will be thrown.

  Specified by:
    `setReturnClass` in interface `Transformer`
  Parameters:
    `newClass` - the expected return type class

### isSourceTypeSupported

    public boolean isSourceTypeSupported(Class aClass)

  Description copied from interface: `Transformer`
  Determines if a particular source class can be handled by this transformer

  Specified by:
    `isSourceTypeSupported` in interface `Transformer`
  Parameters:
    `aClass` - The class to check for compatability
  Returns:
    true if the transformer supports this type of class or false otherwise

### isSourceTypeSupported

    public boolean isSourceTypeSupported(Class aClass,
                                         boolean exactMatch)

### transform

    public final Object transform(Object src)
                           throws TransformerException

  Transforms the object.

  Specified by:
    `transform` in interface `Transformer`
  Parameters:
    `src` - The source object to transform.
  Returns:
    The transformed object
  Throws:
    `TransformerException` - if a error occurs transforming the data or if the expected returnClass isn't the same as the transformed data

### isConsumed

    protected boolean isConsumed(Class srcCls)

### getEndpoint

    public ImmutableEndpoint getEndpoint()

  Description copied from interface: `BaseTransformer`
  The endpoint that this transformer is attached to

  Specified by:
    `getEndpoint` in interface `BaseTransformer`
  Returns:
    the endpoint associated with the transformer

### setEndpoint

    public void setEndpoint(ImmutableEndpoint endpoint)

  Description copied from interface: `BaseTransformer`
  Sets the endpoint associated with with this connector. This should be idempotent, since endpoints do not guarantee it will only be called once.

  Specified by:
    `setEndpoint` in interface `BaseTransformer`
  Parameters:
    `endpoint` - sets the endpoint associated with the transfromer

### doTransform

    protected abstract Object doTransform(Object src,
                                          String encoding)
                                   throws TransformerException

  Throws:
    `TransformerException`

### initialise

    public void initialise()
                    throws InitialisationException

  Template method where deriving classes can do any initialisation after the properties have been set on this transformer

  Specified by:
    `initialise` in interface `Initialisable`
  Throws:
    `InitialisationException`
    `RecoverableException` - if an error occurs that can be recovered from

### generateTransformerName

    protected String generateTransformerName()

### getSourceTypes

    public List getSourceTypes()

  Description copied from interface: `Transformer`
  Returns an unmodifiable list of Source types registered on this transformer

  Specified by:
    `getSourceTypes` in interface `Transformer`
  Returns:
    an unmodifiable list of Source types registered on this transformer

### isIgnoreBadInput

    public boolean isIgnoreBadInput()

  Specified by:
    `isIgnoreBadInput` in interface `Transformer`

### setIgnoreBadInput

    public void setIgnoreBadInput(boolean ignoreBadInput)

### toString

    public String toString()

  Overrides:
    `toString` in class `Object`

### isAcceptNull

    public boolean isAcceptNull()

  Description copied from interface: `Transformer`
  Does this transformer allow null input?

  Specified by:
    `isAcceptNull` in interface `Transformer`
  Returns:
    true if this transformer can accept null input

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-2009 MuleSource, Inc.. All Rights Reserved.