Overview | Package | Class | Use | Tree | Deprecated | Index | Help
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD

## org.mule.module.json.transformers
Class JsonTransformerResolver

    java.lang.Object
      org.mule.module.json.transformers.JsonTransformerResolver

All Implemented Interfaces:
  MuleContextAware, Disposable, TransformerResolver

    public class JsonTransformerResolver

extends Object
implements TransformerResolver, MuleContextAware, Disposable

A `TransformerResolver` implementation used to discover whether the current transform requests requires Json mashaling. The resolver will scan the source and return type for Jackson (http://jackson.codehaus.org) Json annotations and will configure a JSON transformer accordingly. The transformer is cached and will be used for any subsequent requests. The `ObjectMapper` 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 `ObjectMapper` one will be created with the annotated JSON class. This context will cached with the transformer.

Since:
  3.0

Nested Class Summary

Nested classes/interfaces inherited from interface org.mule.api.registry.TransformerResolver
`TransformerResolver.RegistryAction`

Field Summary
`static String` | `JSON_MIME_TYPE`
`protected Log` | `logger` logger used by this class

Fields inherited from interface org.mule.api.lifecycle.Disposable
`PHASE_NAME`

Constructor Summary
`JsonTransformerResolver()`

Method Summary
`void` | `dispose()` A lifecycle method where implementor should free up any resources.
`protected JsonMapperResolver` | `getMapperResolver()`
`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.

Methods inherited from class java.lang.Object
`clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

Field Detail

### JSON_MIME_TYPE

    public static final String JSON_MIME_TYPE

See Also:
  Constant Field Values

### logger

    protected final transient Log logger

  logger used by this class

Constructor Detail

### JsonTransformerResolver

    public JsonTransformerResolver()

Method Detail

### setMuleContext

    public void setMuleContext(MuleContext context)

  Specified by:
    `setMuleContext` in interface `MuleContextAware`

### resolve

    public Transformer resolve(DataType source,
                               DataType result)
                        throws ResolverException

  Description copied from interface: `TransformerResolver`
  Responsible for finding a transformer with the given criteria. Note that if a transformer is not found null should be return, an exception must NOT be thrown.

  Specified by:
    `resolve` in interface `TransformerResolver`
  Parameters:
    `source` - information about the source object including the object iself
    `result` - information about the result object to transform to
  Returns:
    a transformer from the registry that matches the criteria or null if a transformer was not found
  Throws:
    `ResolverException` - Only thrown if an exception is thrown during the search, this exception will just be a wrapper

### transformerChange

    public void transformerChange(Transformer transformer,
                                  TransformerResolver.RegistryAction registryAction)

  Description copied from interface: `TransformerResolver`
  A callback that is called when a transformer is registered or unregistered from the registry. This is used in situations where the resolver caches transformers and the cache needs to be updated

  Specified by:
    `transformerChange` in interface `TransformerResolver`
  Parameters:
    `transformer` - the transformer that has changed
    `registryAction` - whether the transformer was added or removed

### 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`

### getMapperResolver

    protected JsonMapperResolver getMapperResolver()
                                            throws ResolverException

  Throws:
    `ResolverException`

Overview | Package | Class | Use | Tree | Deprecated | Index | Help
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD

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