org.mule.module.xml.transformer.jaxb
Class JAXBContextResolver
java.lang.Object
org.mule.config.transformer.AbstractAnnotatedTransformerArgumentResolver
org.mule.module.xml.transformer.jaxb.JAXBContextResolver
- All Implemented Interfaces:
- Disposable, TransformerArgumentResolver
public class JAXBContextResolver
- extends AbstractAnnotatedTransformerArgumentResolver
This resolver is used by the transform engine to inject a JAXBContext into a method that requires it.
A shared JAXB context can be created for the application and stored in the registry, this will get injected
into any transform methods that add JAXBContext
to the method signature.
IF there is no shared JAXB context one will be created. First this resolver will attempt to create the context from
the package of the the annotated class, for this to work either a jaxb.index file must be present or an ObjectFactory
must be in the package. This allows for JAXB generated classes to be used easily. If this method fails a context will
be created using just the annotated class to initialise the context.
- Since:
- 3.0
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
JAXBContextResolver
public JAXBContextResolver()
getArgumentClass
protected Class getArgumentClass()
- Description copied from class:
AbstractAnnotatedTransformerArgumentResolver
- 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 muleContext)
throws Exception
- Description copied from class:
AbstractAnnotatedTransformerArgumentResolver
- 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 matchedmuleContext
- 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()
- Description copied from class:
AbstractAnnotatedTransformerArgumentResolver
- 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.