org.mule.module.json.transformers
Class JsonToObject

java.lang.Object
  extended by org.mule.transformer.AbstractTransformer
      extended by org.mule.transformer.AbstractMessageAwareTransformer
          extended by org.mule.module.json.transformers.AbstractJsonTransformer
              extended by org.mule.module.json.transformers.JsonToObject
All Implemented Interfaces:
MuleContextAware, Initialisable, NamedObject, BaseTransformer, DiscoverableTransformer, Transformer

public class JsonToObject
extends AbstractJsonTransformer

A transformer that will convert a JSON encoded object graph to a java object. The object type is determined by the 'returnClass' attribute. Note that this transformers supports Arrays and Lists. For example, to convert a JSON string to an array of org.foo.Person, set the the returnClass=[Lorg.foo.Person;.

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.


Field Summary
 
Fields inherited from class org.mule.module.json.transformers.AbstractJsonTransformer
weighting
 
Fields inherited from class org.mule.transformer.AbstractTransformer
DEFAULT_TRUNCATE_LENGTH, endpoint, logger, MULE_MESSAGE_ADAPTER_DATA_TYPE, MULE_MESSAGE_DATA_TYPE, muleContext, name, returnType, 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
JsonToObject()
           
 
Method Summary
 Map<Class,Class> getDeserializationMixins()
           
 void initialise()
          Template method where deriving classes can do any initialisation after the properties have been set on this transformer
 void setDeserializationMixins(Map<Class,Class> deserializationMixins)
           
 Object transform(MuleMessage message, String outputEncoding)
           
 
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, isSourceDataTypeSupported
 
Methods inherited from class org.mule.transformer.AbstractTransformer
checkReturnClass, generateTransformerName, getEncoding, getEndpoint, getName, getReturnClass, getReturnDataType, getSourceDataTypes, getSourceTypes, isAcceptNull, isConsumed, isIgnoreBadInput, isSourceDataTypeSupported, isSourceTypeSupported, isSourceTypeSupported, registerSourceType, registerSourceType, setEndpoint, setIgnoreBadInput, setMuleContext, setName, setReturnClass, setReturnDataType, toString, transform, transform, unregisterSourceType, unregisterSourceType
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

JsonToObject

public JsonToObject()
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 outputEncoding)
                 throws TransformerException
Specified by:
transform in class AbstractMessageAwareTransformer
Throws:
TransformerException

getDeserializationMixins

public Map<Class,Class> getDeserializationMixins()

setDeserializationMixins

public void setDeserializationMixins(Map<Class,Class> deserializationMixins)


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