org.mule.module.json.transformers
Class JsonMapperResolver
java.lang.Object
org.mule.config.transformer.AbstractAnnotatedTransformerArgumentResolver
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
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
ANNOTATIONS_PACKAGE_NAME
public static final String ANNOTATIONS_PACKAGE_NAME
- See Also:
- Constant Field Values
JsonMapperResolver
public JsonMapperResolver()
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 matchedcontext
- 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-2012 MuleSoft, Inc.. All Rights Reserved.