|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES All Classes | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectorg.mule.transformer.AbstractTransformer
public abstract class AbstractTransformer
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 |
---|
protected static final int DEFAULT_TRUNCATE_LENGTH
protected final Log logger
protected Class returnClass
transform(java.lang.Object)
method is
called
protected String name
protected ImmutableEndpoint endpoint
protected final List sourceTypes
Constructor Detail |
---|
public AbstractTransformer()
Method Detail |
---|
protected Object checkReturnClass(Object object) throws TransformerException
TransformerException
protected void registerSourceType(Class aClass)
protected void unregisterSourceType(Class aClass)
public String getName()
NamedObject
getName
in interface NamedObject
public void setName(String string)
NamedObject
setName
in interface NamedObject
string
- public Class getReturnClass()
getReturnClass
in interface Transformer
public void setReturnClass(Class newClass)
Transformer
TransformerException
will be
thrown.
setReturnClass
in interface Transformer
newClass
- the expected return type classpublic boolean isSourceTypeSupported(Class aClass)
Transformer
isSourceTypeSupported
in interface Transformer
aClass
- The class to check for compatability
public boolean isSourceTypeSupported(Class aClass, boolean exactMatch)
public final Object transform(Object src) throws TransformerException
transform
in interface Transformer
src
- 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()
BaseTransformer
getEndpoint
in interface BaseTransformer
public void setEndpoint(ImmutableEndpoint endpoint)
BaseTransformer
setEndpoint
in interface BaseTransformer
endpoint
- sets the endpoint associated with the transfromerprotected abstract Object doTransform(Object src, String encoding) throws TransformerException
TransformerException
public void initialise() throws InitialisationException
initialise
in interface Initialisable
InitialisationException
RecoverableException
- if an error occurs that can be recovered fromprotected String generateTransformerName()
public List getSourceTypes()
Transformer
getSourceTypes
in interface Transformer
public boolean isIgnoreBadInput()
isIgnoreBadInput
in interface Transformer
public void setIgnoreBadInput(boolean ignoreBadInput)
public String toString()
toString
in class Object
public boolean isAcceptNull()
Transformer
isAcceptNull
in interface Transformer
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES All Classes | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |