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.
| 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 |
logger
protected final transient Log logger
- logger used by this class
sourceClass
protected Class sourceClass
ObjectToJson
public ObjectToJson()
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)
Copyright © 2003-2009 MuleSource, Inc.. All Rights Reserved.