|
||||||||||
| 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 chain| Method Detail |
|---|
public boolean isSourceTypeSupported(Class<?> aClass)
Transformer
isSourceTypeSupported in interface TransformeraClass - The class to check for compatibility
public boolean isSourceDataTypeSupported(DataType<?> dataType)
Transformer
isSourceDataTypeSupported in interface TransformerdataType - The DataType to check for compatibility
public List<Class<?>> getSourceTypes()
Transformer
getSourceTypes in interface Transformerpublic List<DataType<?>> getSourceDataTypes()
Transformer
getSourceDataTypes in interface Transformerpublic boolean isAcceptNull()
Transformer
isAcceptNull in interface Transformerpublic boolean isIgnoreBadInput()
Transformer
isIgnoreBadInput in interface Transformer
public Object transform(Object src)
throws TransformerException
Transformer
transform in interface Transformersrc - the data to transform
TransformerException - if a error occurs transforming the data or if the
expected returnClass isn't the same as the transformed data
public Object transform(Object src,
String encoding)
throws TransformerException
Transformer
transform in interface Transformersrc - 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)
TransformerTransformerException will be
thrown.
setReturnClass in interface TransformertheClass - the expected return type classpublic Class<?> getReturnClass()
Transformer
getReturnClass in interface Transformerpublic void setReturnDataType(DataType<?> type)
TransformerTransformerException 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 Transformertype - the expected return type for this transformerpublic DataType<?> getReturnDataType()
TransformerTransformer.getReturnClass() because it allows Generics information to be associated with the
return type of the transformer
getReturnDataType in interface Transformerpublic String getMimeType()
Transformer
getMimeType in interface Transformerpublic String getEncoding()
Transformer
getEncoding in interface Transformerpublic ImmutableEndpoint getEndpoint()
Transformer
getEndpoint in interface Transformerpublic void dispose()
Disposable
dispose in interface Disposablepublic void setEndpoint(ImmutableEndpoint ep)
setEndpoint in interface EndpointAware
public void initialise()
throws InitialisationException
InitialisableInitialisationException 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 InitialisableInitialisationException - if a fatal error occurs causing the Mule instance to shutdown
RecoverableException - if an error occurs that can be recovered from
public MuleEvent process(MuleEvent event)
throws MuleException
MessageProcessor
process in interface MessageProcessorevent - MuleEvent to be processed
MuleExceptionpublic void setMuleContext(MuleContext context)
setMuleContext in interface MuleContextAwarepublic void setName(String name)
NameableObject
setName in interface NameableObjectname - the name of the objectpublic String getName()
NamedObject
getName in interface NamedObjectpublic int getPriorityWeighting()
Converter
getPriorityWeighting in interface ConverterConverter.MIN_PRIORITY_WEIGHTING and Converter.MAX_PRIORITY_WEIGHTING.public void setPriorityWeighting(int weighting)
Converter
setPriorityWeighting in interface Converterweighting - 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 | |||||||||