public class CompositeConverter extends Object implements Converter
transform(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.DEFAULT_PRIORITY_WEIGHTING, MAX_PRIORITY_WEIGHTING, MIN_PRIORITY_WEIGHTINGPHASE_NAMEPHASE_NAME| Constructor and Description |
|---|
CompositeConverter(Converter... converters)
Create a new conversion chain using the specified converters
|
| Modifier and Type | Method and Description |
|---|---|
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
|
public CompositeConverter(Converter... converters)
converters - List of converters using to build the chainpublic boolean isSourceTypeSupported(Class<?> aClass)
TransformerisSourceTypeSupported in interface TransformeraClass - The class to check for compatibilitypublic boolean isSourceDataTypeSupported(DataType<?> dataType)
TransformerisSourceDataTypeSupported in interface TransformerdataType - The DataType to check for compatibilitypublic List<Class<?>> getSourceTypes()
TransformergetSourceTypes in interface Transformerpublic List<DataType<?>> getSourceDataTypes()
TransformergetSourceDataTypes in interface Transformerpublic boolean isAcceptNull()
TransformerisAcceptNull in interface Transformerpublic boolean isIgnoreBadInput()
TransformerisIgnoreBadInput in interface Transformerpublic Object transform(Object src) throws TransformerException
Transformertransform in interface Transformersrc - the data to transformTransformerException - 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
Transformertransform 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 encodingTransformerException - 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()
TransformergetReturnClass 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 transformersetReturnDataType 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 transformergetReturnDataType in interface Transformerpublic String getMimeType()
TransformergetMimeType in interface Transformerpublic String getEncoding()
TransformergetEncoding in interface Transformerpublic ImmutableEndpoint getEndpoint()
TransformergetEndpoint in interface Transformerpublic void dispose()
Disposabledispose in interface Disposablepublic void setEndpoint(ImmutableEndpoint ep)
setEndpoint in interface EndpointAwarepublic 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 shutdownRecoverableException - if an error occurs that can be recovered frompublic MuleEvent process(MuleEvent event) throws MuleException
MessageProcessorprocess in interface MessageProcessorevent - MuleEvent to be processedMuleExceptionpublic void setMuleContext(MuleContext context)
setMuleContext in interface MuleContextAwarepublic void setName(String name)
NameableObjectsetName in interface NameableObjectname - the name of the objectpublic String getName()
NamedObjectgetName in interface NamedObjectpublic int getPriorityWeighting()
ConvertergetPriorityWeighting in interface ConverterConverter.MIN_PRIORITY_WEIGHTING and Converter.MAX_PRIORITY_WEIGHTING.public void setPriorityWeighting(int weighting)
ConvertersetPriorityWeighting 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()
Copyright © 2003–2015 MuleSoft, Inc.. All rights reserved.