|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectorg.mule.transformer.CompositeConverter
public class CompositeConverter
Composes many converters to behave as a single one.
Whentransform(Object)
is called each converter in the same order
they are included in the composition.
The output of a given converter is the input of the next composed converter.
Field Summary |
---|
Fields inherited from interface org.mule.api.transformer.Converter |
---|
DEFAULT_PRIORITY_WEIGHTING, MAX_PRIORITY_WEIGHTING, MIN_PRIORITY_WEIGHTING |
Fields inherited from interface org.mule.api.lifecycle.Initialisable |
---|
PHASE_NAME |
Fields inherited from interface org.mule.api.lifecycle.Disposable |
---|
PHASE_NAME |
Constructor Summary | |
---|---|
CompositeConverter(Converter... converters)
Create a new conversion chain using the specified converters |
Method Summary | |
---|---|
void |
dispose()
A lifecycle method where implementor should free up any resources. |
LinkedList<Converter> |
getConverters()
|
String |
getEncoding()
Return the encoding returned by the transformer (if any). |
ImmutableEndpoint |
getEndpoint()
The endpoint that this transformer is attached to |
String |
getMimeType()
Return the mime type returned by the transformer (if any). |
String |
getName()
Gets the name of the object |
int |
getPriorityWeighting()
If two or more discoverable transformers are equal, this value can be used to select the correct one |
Class<?> |
getReturnClass()
Specifies the Java type of the result after this transformer has been executed. |
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()
Returns an unmodifiable list of Source types registered on this transformer |
void |
initialise()
Method used to perform any initialisation work. |
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)
Determines if a particular source class can be handled by this transformer |
MuleEvent |
process(MuleEvent event)
Invokes the MessageProcessor. |
void |
setEndpoint(ImmutableEndpoint ep)
|
void |
setMuleContext(MuleContext context)
|
void |
setName(String name)
Sets the name of the object |
void |
setPriorityWeighting(int weighting)
If 2 or more discoverable transformers are equal, this value can be used to select the correct one |
void |
setReturnClass(Class<?> theClass)
Sets the expected return type for the transformed data. |
void |
setReturnDataType(DataType<?> type)
Sets the expected return type for the transformed data. |
Object |
transform(Object src)
Transforms the supplied data and returns the result |
Object |
transform(Object src,
String encoding)
Transforms the supplied data and returns the result |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Constructor Detail |
---|
public CompositeConverter(Converter... converters)
converters
- List of converters using to build the chainMethod Detail |
---|
public boolean isSourceTypeSupported(Class<?> aClass)
Transformer
isSourceTypeSupported
in interface Transformer
aClass
- The class to check for compatibility
public boolean isSourceDataTypeSupported(DataType<?> dataType)
Transformer
isSourceDataTypeSupported
in interface Transformer
dataType
- The DataType to check for compatibility
public List<Class<?>> getSourceTypes()
Transformer
getSourceTypes
in interface Transformer
public List<DataType<?>> getSourceDataTypes()
Transformer
getSourceDataTypes
in interface Transformer
public boolean isAcceptNull()
Transformer
isAcceptNull
in interface Transformer
public boolean isIgnoreBadInput()
Transformer
isIgnoreBadInput
in interface Transformer
public Object transform(Object src) throws TransformerException
Transformer
transform
in interface Transformer
src
- the data to transform
TransformerException
- if a error occurs transforming the data or if the
expected returnClass isn't the same as the transformed datapublic Object transform(Object src, String encoding) throws TransformerException
Transformer
transform
in interface Transformer
src
- the data to transformencoding
- 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
TransformerException
- if a error occurs transforming the data or if the
expected returnClass isn't the same as the transformed datapublic void setReturnClass(Class<?> theClass)
Transformer
TransformerException
will be
thrown.
setReturnClass
in interface Transformer
theClass
- the expected return type classpublic Class<?> getReturnClass()
Transformer
getReturnClass
in interface Transformer
public void setReturnDataType(DataType<?> type)
Transformer
TransformerException
will be
thrown.
This method supersedes Transformer.getReturnClass()
because it allows Generics information to be associated with the
return type of the transformer
setReturnDataType
in interface Transformer
type
- the expected return type for this transformerpublic DataType<?> getReturnDataType()
Transformer
Transformer.getReturnClass()
because it allows Generics information to be associated with the
return type of the transformer
getReturnDataType
in interface Transformer
public String getMimeType()
Transformer
getMimeType
in interface Transformer
public String getEncoding()
Transformer
getEncoding
in interface Transformer
public ImmutableEndpoint getEndpoint()
Transformer
getEndpoint
in interface Transformer
public void dispose()
Disposable
dispose
in interface Disposable
public void setEndpoint(ImmutableEndpoint ep)
setEndpoint
in interface EndpointAware
public void initialise() throws InitialisationException
Initialisable
InitialisationException
should be thrown,
causing the Mule instance to shutdown. If the error is recoverable, say by
retrying to connect, a RecoverableException
should be thrown.
There is no guarantee that by throwing a Recoverable exception that the Mule
instance will not shut down.
initialise
in interface Initialisable
InitialisationException
- if a fatal error occurs causing the Mule instance to shutdown
RecoverableException
- if an error occurs that can be recovered frompublic MuleEvent process(MuleEvent event) throws MuleException
MessageProcessor
process
in interface MessageProcessor
event
- MuleEvent to be processed
MuleException
public void setMuleContext(MuleContext context)
setMuleContext
in interface MuleContextAware
public void setName(String name)
NameableObject
setName
in interface NameableObject
name
- the name of the objectpublic String getName()
NamedObject
getName
in interface NamedObject
public int getPriorityWeighting()
Converter
getPriorityWeighting
in interface Converter
Converter.MIN_PRIORITY_WEIGHTING
and Converter.MAX_PRIORITY_WEIGHTING
.public void setPriorityWeighting(int weighting)
Converter
setPriorityWeighting
in interface Converter
weighting
- the priority weighting for this transformer. This is a value between
Converter.MIN_PRIORITY_WEIGHTING
and Converter.MAX_PRIORITY_WEIGHTING
.public LinkedList<Converter> getConverters()
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |