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 ObjectToJson

    java.lang.Object
      org.mule.transformer.AbstractTransformer
          org.mule.transformer.AbstractMessageAwareTransformer
              org.mule.module.json.transformers.AbstractJsonTransformer
                  org.mule.module.json.transformers.ObjectToJson

All Implemented Interfaces:
  MuleContextAware, Initialisable, NamedObject, BaseTransformer, DiscoverableTransformer, Transformer

    public class ObjectToJson

extends AbstractJsonTransformer

Converts a java object to a JSON encoded object that can be consumed by other languages such as Javascript or Ruby.

The JSON engine can be configured using the jsonConfig attribute. This is an object reference to an instance of: `net.sf.json.JsonConfig`. This can be created as a spring bean.

Users can configure a comma-separated list of property names to exclude or include i.e. excludeProperties="address,postcode".

The returnClass for this transformer is always java.lang.String, there is no need to set this.

Field Summary
`protected Log` | `logger` logger used by this class
`protected Class` | `sourceClass`

Fields inherited from class org.mule.module.json.transformers.AbstractJsonTransformer
`weighting`

Fields inherited from class org.mule.transformer.AbstractTransformer
`DEFAULT_TRUNCATE_LENGTH, endpoint, muleContext, name, returnClass, sourceTypes`

Fields inherited from interface org.mule.api.transformer.DiscoverableTransformer
`DEFAULT_PRIORITY_WEIGHTING, MAX_PRIORITY_WEIGHTING, MIN_PRIORITY_WEIGHTING`

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

Constructor Summary
`ObjectToJson()`

Method Summary
`Map<Class,Class>` | `getSerializationMixins()`
`Class` | `getSourceClass()`
`void` | `initialise()` Template method where deriving classes can do any initialisation after the properties have been set on this transformer
`boolean` | `isHandleException()`
`void` | `setHandleException(boolean handleException)`
`void` | `setSerializationMixins(Map<Class,Class> serializationMixins)`
`void` | `setSourceClass(Class sourceClass)`
`Object` | `transform(MuleMessage message, String encoding)`

Methods inherited from class org.mule.module.json.transformers.AbstractJsonTransformer
`getMapper, getMixins, getPriorityWeighting, setMapper, setMixins, setPriorityWeighting`

Methods inherited from class org.mule.transformer.AbstractMessageAwareTransformer
`doTransform, isSourceTypeSupported`

Methods inherited from class org.mule.transformer.AbstractTransformer
`checkReturnClass, generateTransformerName, getEncoding, getEndpoint, getName, getReturnClass, getSourceTypes, isAcceptNull, isConsumed, isIgnoreBadInput, isSourceTypeSupported, registerSourceType, setEndpoint, setIgnoreBadInput, setMuleContext, setName, setReturnClass, toString, transform, transform, unregisterSourceType`

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

Field Detail

### logger

    protected final transient Log logger

  logger used by this class

### sourceClass

    protected Class sourceClass

Constructor Detail

### ObjectToJson

    public ObjectToJson()

Method Detail

### initialise

    public void initialise()
                    throws InitialisationException

  Description copied from class: `AbstractTransformer`
  Template method where deriving classes can do any initialisation after the properties have been set on this transformer

  Specified by:
    `initialise` in interface `Initialisable`
  Overrides:
    `initialise` in class `AbstractJsonTransformer`
  Throws:
    `InitialisationException` - if a fatal error occurs causing the Mule instance to shutdown
    `RecoverableException` - if an error occurs that can be recovered from

### transform

    public Object transform(MuleMessage message,
                            String encoding)
                     throws TransformerException

  Specified by:
    `transform` in class `AbstractMessageAwareTransformer`
  Throws:
    `TransformerException`

### isHandleException

    public boolean isHandleException()

### setHandleException

    public void setHandleException(boolean handleException)

### getSourceClass

    public Class getSourceClass()

### setSourceClass

    public void setSourceClass(Class sourceClass)

### getSerializationMixins

    public Map<Class,Class> getSerializationMixins()

### setSerializationMixins

    public void setSerializationMixins(Map<Class,Class> serializationMixins)

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-2009 MuleSource, Inc.. All Rights Reserved.