public class JAXBTransformerResolver extends Object implements TransformerResolver, MuleContextAware, Disposable
TransformerResolver
implementation used to discover whether the current transform
requests requires JAXB. The resolver will scan the source and return type for JAXB 2 annotations and will configure
a JAXB transformer accordingly. The transformer is cached and will be used for any subsequent requests.
The JAXBContext
instance needed for the transform can be discovered from the registry, this means one can be
pre-configured in Spring or Guice. If there is no pre-configured JAXBContext
one will be created with the
annotated JAXB class. This context will cached with the transformer.TransformerResolver.RegistryAction
Modifier and Type | Field and Description |
---|---|
static String[] |
ignoredPackages |
protected Log |
logger
logger used by this class
|
PHASE_NAME
Constructor and Description |
---|
JAXBTransformerResolver() |
Modifier and Type | Method and Description |
---|---|
void |
dispose()
A lifecycle method where implementor should free up any resources.
|
protected JAXBContextResolver |
getContextResolver() |
protected boolean |
hasJaxbAnnotations(Class annotatedType) |
Transformer |
resolve(DataType source,
DataType result)
Responsible for finding a transformer with the given criteria.
|
void |
setMuleContext(MuleContext context) |
void |
transformerChange(Transformer transformer,
TransformerResolver.RegistryAction registryAction)
A callback that is called when a transformer is registered or unregistered
from the registry.
|
public static final String[] ignoredPackages
protected final transient Log logger
public void setMuleContext(MuleContext context)
setMuleContext
in interface MuleContextAware
public Transformer resolve(DataType source, DataType result) throws ResolverException
TransformerResolver
resolve
in interface TransformerResolver
source
- information about the source object including the object iselfresult
- information about the result object to transform toResolverException
- Only thrown if an exception is thrown during the
search, this exception will just be a wrapperpublic void transformerChange(Transformer transformer, TransformerResolver.RegistryAction registryAction)
TransformerResolver
transformerChange
in interface TransformerResolver
transformer
- the transformer that has changedregistryAction
- whether the transformer was added or removedpublic void dispose()
Disposable
dispose
in interface Disposable
protected JAXBContextResolver getContextResolver() throws RegistrationException
RegistrationException
protected boolean hasJaxbAnnotations(Class annotatedType)
Copyright © 2003–2016 MuleSoft, Inc.. All rights reserved.