public abstract class AbstractTransformer extends Object implements Transformer
AbstractTransformer is a base class for all transformers.
Transformations transform one object into another.| Modifier and Type | Field and Description |
|---|---|
protected static int |
DEFAULT_TRUNCATE_LENGTH |
protected ImmutableEndpoint |
endpoint
The endpoint that this transformer instance is configured on
|
protected org.apache.commons.logging.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
|
PHASE_NAME| Constructor and Description |
|---|
AbstractTransformer()
default constructor required for discovery
|
| Modifier and Type | Method and Description |
|---|---|
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()
Gts 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) |
protected static final int DEFAULT_TRUNCATE_LENGTH
protected final org.apache.commons.logging.Log logger
protected Class returnClass
transform(java.lang.Object) method is
calledprotected String name
protected ImmutableEndpoint endpoint
protected final List sourceTypes
public AbstractTransformer()
protected Object checkReturnClass(Object object) throws TransformerException
TransformerExceptionprotected void registerSourceType(Class aClass)
protected void unregisterSourceType(Class aClass)
public String getName()
NamedObjectgetName in interface NamedObjectpublic void setName(String string)
NamedObjectsetName in interface NamedObjectstring - public Class getReturnClass()
getReturnClass in interface Transformerpublic void setReturnClass(Class newClass)
TransformerTransformerException will be
thrown.setReturnClass in interface TransformernewClass - the expected return type classpublic boolean isSourceTypeSupported(Class aClass)
TransformerisSourceTypeSupported in interface TransformeraClass - The class to check for compatabilitypublic boolean isSourceTypeSupported(Class aClass, boolean exactMatch)
public final Object transform(Object src) throws TransformerException
transform in interface Transformersrc - The source object to transform.TransformerException - if a error occurs transforming the data or if the
expected returnClass isn't the same as the transformed dataprotected boolean isConsumed(Class srcCls)
public ImmutableEndpoint getEndpoint()
BaseTransformergetEndpoint in interface BaseTransformerpublic void setEndpoint(ImmutableEndpoint endpoint)
BaseTransformersetEndpoint in interface BaseTransformerendpoint - sets the endpoint associated with the transfromerprotected abstract Object doTransform(Object src, String encoding) throws TransformerException
TransformerExceptionpublic void initialise()
throws InitialisationException
initialise in interface InitialisableInitialisationExceptionRecoverableException - if an error occurs that can be recovered fromprotected String generateTransformerName()
public List getSourceTypes()
TransformergetSourceTypes in interface Transformerpublic boolean isIgnoreBadInput()
isIgnoreBadInput in interface Transformerpublic void setIgnoreBadInput(boolean ignoreBadInput)
public boolean isAcceptNull()
TransformerisAcceptNull in interface TransformerCopyright © 2003-2012 MuleSource, Inc.. All Rights Reserved.