org.mule.registry
Class TypeBasedTransformerResolver
java.lang.Object
org.mule.registry.TypeBasedTransformerResolver
- All Implemented Interfaces:
- MuleContextAware, Disposable, Initialisable, TransformerResolver
public class TypeBasedTransformerResolver
- extends Object
- implements TransformerResolver, MuleContextAware, Disposable, Initialisable
Will discover transformers based on type information only. It looks for transformers that support
the source and result types passed into the method. This resolver only resolves on the first
source type, which is the way transformer resolution working in Mule 2.x.
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
logger
protected final transient Log logger
- logger used by this class
exactTransformerCache
protected Map<String,Transformer> exactTransformerCache
graphTransformerResolver
protected TransformerResolver graphTransformerResolver
TypeBasedTransformerResolver
public TypeBasedTransformerResolver()
setMuleContext
public void setMuleContext(MuleContext context)
- Specified by:
setMuleContext
in interface MuleContextAware
initialise
public void initialise()
throws InitialisationException
- Description copied from interface:
Initialisable
- Method used to perform any initialisation work. If a fatal error occurs during
initialisation an
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.
- Specified by:
initialise
in interface Initialisable
- Throws:
InitialisationException
- if a fatal error occurs causing the Mule instance to shutdown
RecoverableException
- if an error occurs that can be recovered from
resolve
public Transformer resolve(DataType source,
DataType result)
throws ResolverException
- Description copied from interface:
TransformerResolver
- Responsible for finding a transformer with the given criteria. Note that if a
transformer is not found null should be return, an exception must NOT be
thrown.
- Specified by:
resolve
in interface TransformerResolver
- Parameters:
source
- information about the source object including the object iselfresult
- information about the result object to transform to
- Returns:
- a transformer from the registry that matches the criteria or null if a
transformer was not found
- Throws:
ResolverException
- Only thrown if an exception is thrown during the
search, this exception will just be a wrapper
getNearestTransformerMatch
protected Transformer getNearestTransformerMatch(List<Transformer> trans,
Class input,
Class output)
throws ResolverException
- Throws:
ResolverException
dispose
public void dispose()
- Description copied from interface:
Disposable
- A lifecycle method where implementor should free up any resources. If an
exception is thrown it should just be logged and processing should continue.
This method should not throw Runtime exceptions.
- Specified by:
dispose
in interface Disposable
transformerChange
public void transformerChange(Transformer transformer,
TransformerResolver.RegistryAction registryAction)
- Description copied from interface:
TransformerResolver
- A callback that is called when a transformer is registered or unregistered
from the registry. This is used in situations where the resolver caches
transformers and the cache needs to be updated.
- Specified by:
transformerChange
in interface TransformerResolver
- Parameters:
transformer
- the transformer that has changedregistryAction
- whether the transformer was added or removed
Copyright © 2003-2012 MuleSoft, Inc.. All Rights Reserved.