org.mule.config.transformer
Class AbstractAnnotatedTransformerArgumentResolver

java.lang.Object
  extended by org.mule.config.transformer.AbstractAnnotatedTransformerArgumentResolver
All Implemented Interfaces:
Disposable, TransformerArgumentResolver
Direct Known Subclasses:
JAXBContextResolver, JsonMapperResolver

public abstract class AbstractAnnotatedTransformerArgumentResolver
extends java.lang.Object
implements TransformerArgumentResolver, Disposable

An abstract resolver that can be extend to resolve/create an object based on Annotated classes. These classes can be scanned and used to create the context. Typically this class will be used to create resolvers for binding frameworks where the data type classes are annotated with binding information.


Field Summary
static java.lang.String[] ignoredPackages
           
protected  Log logger
          logger used by this class
 
Fields inherited from interface org.mule.api.lifecycle.Disposable
PHASE_NAME
 
Constructor Summary
AbstractAnnotatedTransformerArgumentResolver()
           
 
Method Summary
protected abstract  java.lang.Object createArgument(java.lang.Class<?> annotatedType, MuleContext muleContext)
          If the resolver cannot locate the required object of type getArgumentClass() this method will be invoked an instance of the object.
 void dispose()
          A lifecycle method where implementor should free up any resources.
protected  boolean findAnnotation(java.lang.Class annotatedType)
           
protected abstract  java.lang.String getAnnotationsPackageName()
          This resolver scans a class for annotations in this package.
protected abstract  java.lang.Class<?> getArgumentClass()
          The object type that this resolver will discover or create
 java.util.Set<java.lang.Class> getMatchingClasses()
           
 java.util.Set<java.lang.Class> getNonMatchingClasses()
           
protected  boolean isNonMatching(DataType source, DataType result)
           
<T> T
resolve(java.lang.Class<T> type, DataType source, DataType result, MuleContext context)
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

ignoredPackages

public static final java.lang.String[] ignoredPackages

logger

protected final transient Log logger
logger used by this class

Constructor Detail

AbstractAnnotatedTransformerArgumentResolver

public AbstractAnnotatedTransformerArgumentResolver()
Method Detail

resolve

public <T> T resolve(java.lang.Class<T> type,
                     DataType source,
                     DataType result,
                     MuleContext context)
          throws java.lang.Exception
Specified by:
resolve in interface TransformerArgumentResolver
Throws:
java.lang.Exception

findAnnotation

protected boolean findAnnotation(java.lang.Class annotatedType)
                          throws java.io.IOException
Throws:
java.io.IOException

isNonMatching

protected boolean isNonMatching(DataType source,
                                DataType result)

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

getMatchingClasses

public java.util.Set<java.lang.Class> getMatchingClasses()

getNonMatchingClasses

public java.util.Set<java.lang.Class> getNonMatchingClasses()

getArgumentClass

protected abstract java.lang.Class<?> getArgumentClass()
The object type that this resolver will discover or create

Returns:
The object type that this resolver will discover or create

createArgument

protected abstract java.lang.Object createArgument(java.lang.Class<?> annotatedType,
                                                   MuleContext muleContext)
                                            throws java.lang.Exception
If the resolver cannot locate the required object of type getArgumentClass() this method will be invoked an instance of the object.

Parameters:
annotatedType - the annotated object that was matched
muleContext - the current Mule context.
Returns:
a new instance of the object being resolved. This method may also retain a shared instance and possible add configuration to the instance based on this invocation
Throws:
java.lang.Exception - if the object cannot be created

getAnnotationsPackageName

protected abstract java.lang.String getAnnotationsPackageName()
This resolver scans a class for annotations in this package. Note this behaviour can be changed by overloading the findAnnotation(Class) method and search based on your own criteria

Returns:
the package of the annotation(s) to scan for


Copyright © 2003-2010 MuleSoft, Inc.. All Rights Reserved.