org.mule.module.json.transformers
Class JsonMapperResolver

java.lang.Object
  extended by org.mule.config.transformer.AbstractAnnotatedTransformerArgumentResolver
      extended by org.mule.module.json.transformers.JsonMapperResolver
All Implemented Interfaces:
Disposable, TransformerArgumentResolver

public class JsonMapperResolver
extends AbstractAnnotatedTransformerArgumentResolver

This resolver is used by the transform engine to inject a ObjectMapper into a method that requires it. A shared ObjectMapper context can be created for the application and stored in the registry, this will get injected into any transform methods that add ObjectMapper to the method signature.

If there is no shared Object Mapper one will be created for the transformer using the return type as the Json root element.

Since:
3.0

Field Summary
static String ANNOTATIONS_PACKAGE_NAME
           
 
Fields inherited from class org.mule.config.transformer.AbstractAnnotatedTransformerArgumentResolver
ignoredPackages, logger
 
Fields inherited from interface org.mule.api.lifecycle.Disposable
PHASE_NAME
 
Constructor Summary
JsonMapperResolver()
           
 
Method Summary
protected  Object createArgument(Class<?> annotatedType, MuleContext context)
          If the resolver cannot locate the required object of type AbstractAnnotatedTransformerArgumentResolver.getArgumentClass() this method will be invoked an instance of the object.
protected  String getAnnotationsPackageName()
          This resolver scans a class for annotations in this package.
protected  Class<?> getArgumentClass()
          The object type that this resolver will discover or create
 
Methods inherited from class org.mule.config.transformer.AbstractAnnotatedTransformerArgumentResolver
dispose, findAnnotation, getMatchingClasses, getNonMatchingClasses, isNonMatching, resolve
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

ANNOTATIONS_PACKAGE_NAME

public static final String ANNOTATIONS_PACKAGE_NAME
See Also:
Constant Field Values
Constructor Detail

JsonMapperResolver

public JsonMapperResolver()
Method Detail

getArgumentClass

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

Specified by:
getArgumentClass in class AbstractAnnotatedTransformerArgumentResolver
Returns:
The object type that this resolver will discover or create

createArgument

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

Specified by:
createArgument in class AbstractAnnotatedTransformerArgumentResolver
Parameters:
annotatedType - the annotated object that was matched
context - 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:
Exception - if the object cannot be created

getAnnotationsPackageName

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

Specified by:
getAnnotationsPackageName in class AbstractAnnotatedTransformerArgumentResolver
Returns:
the package of the annotation(s) to scan for


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