org.mule.transformer.simple
Class ObjectToString

java.lang.Object
  extended by org.mule.transformer.AbstractTransformer
      extended by org.mule.transformer.simple.ObjectToString
All Implemented Interfaces:
AnnotatedObject, MuleContextAware, Disposable, Initialisable, NameableObject, NamedObject, MessageProcessor, Converter, DiscoverableTransformer, Transformer, EndpointAware

public class ObjectToString
extends AbstractTransformer
implements DiscoverableTransformer

ObjectToString transformer is useful for debugging. It will return human-readable output for various kinds of objects. Right now, it is just coded to handle Map and Collection objects. Others will be added.


Field Summary
protected static int DEFAULT_BUFFER_SIZE
           
 
Fields inherited from class org.mule.transformer.AbstractTransformer
encoding, endpoint, logger, mimeType, MULE_MESSAGE_DATA_TYPE, muleContext, name, returnType, sourceTypes
 
Fields inherited from interface org.mule.api.transformer.Converter
DEFAULT_PRIORITY_WEIGHTING, MAX_PRIORITY_WEIGHTING, MIN_PRIORITY_WEIGHTING
 
Fields inherited from interface org.mule.api.lifecycle.Initialisable
PHASE_NAME
 
Fields inherited from interface org.mule.api.lifecycle.Disposable
PHASE_NAME
 
Fields inherited from interface org.mule.api.AnnotatedObject
PROPERTY_NAME
 
Constructor Summary
ObjectToString()
           
 
Method Summary
protected  String createStringFromByteArray(byte[] bytes, String outputEncoding)
           
protected  String createStringFromInputStream(InputStream input, String outputEncoding)
           
protected  String createStringFromOutputHandler(OutputHandler handler, String outputEncoding)
           
 Object doTransform(Object src, String outputEncoding)
           
 int getPriorityWeighting()
          If two or more discoverable transformers are equal, this value can be used to select the correct one
 void setPriorityWeighting(int priorityWeighting)
          If 2 or more discoverable transformers are equal, this value can be used to select the correct one
 
Methods inherited from class org.mule.transformer.AbstractTransformer
dispose, generateTransformerName, getAnnotation, getAnnotations, getEncoding, getEncoding, getEndpoint, getMimeType, getName, getReturnClass, getReturnDataType, getSourceDataTypes, getSourceTypes, initialise, isAcceptNull, isAllowNullReturn, isConsumed, isIgnoreBadInput, isSourceDataTypeSupported, isSourceDataTypeSupported, isSourceTypeSupported, isSourceTypeSupported, process, registerSourceType, registerSourceType, setAllowNullReturn, setAnnotations, setEncoding, setEndpoint, setIgnoreBadInput, setMimeType, 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
 
Methods inherited from interface org.mule.api.transformer.Transformer
getEncoding, getEndpoint, getMimeType, getReturnClass, getReturnDataType, getSourceDataTypes, getSourceTypes, isAcceptNull, isIgnoreBadInput, isSourceDataTypeSupported, isSourceTypeSupported, setReturnClass, setReturnDataType, transform, transform
 
Methods inherited from interface org.mule.api.processor.MessageProcessor
process
 
Methods inherited from interface org.mule.api.lifecycle.Initialisable
initialise
 
Methods inherited from interface org.mule.api.lifecycle.Disposable
dispose
 
Methods inherited from interface org.mule.api.NameableObject
setName
 
Methods inherited from interface org.mule.api.NamedObject
getName
 
Methods inherited from interface org.mule.api.context.MuleContextAware
setMuleContext
 
Methods inherited from interface org.mule.endpoint.EndpointAware
setEndpoint
 

Field Detail

DEFAULT_BUFFER_SIZE

protected static final int DEFAULT_BUFFER_SIZE
See Also:
Constant Field Values
Constructor Detail

ObjectToString

public ObjectToString()
Method Detail

doTransform

public Object doTransform(Object src,
                          String outputEncoding)
                   throws TransformerException
Specified by:
doTransform in class AbstractTransformer
Throws:
TransformerException

createStringFromInputStream

protected String createStringFromInputStream(InputStream input,
                                             String outputEncoding)
                                      throws TransformerException
Throws:
TransformerException

createStringFromOutputHandler

protected String createStringFromOutputHandler(OutputHandler handler,
                                               String outputEncoding)
                                        throws TransformerException
Throws:
TransformerException

createStringFromByteArray

protected String createStringFromByteArray(byte[] bytes,
                                           String outputEncoding)
                                    throws TransformerException
Throws:
TransformerException

getPriorityWeighting

public int getPriorityWeighting()
Description copied from interface: Converter
If two or more discoverable transformers are equal, this value can be used to select the correct one

Specified by:
getPriorityWeighting in interface Converter
Returns:
the priority weighting for this transformer. This is a value between Converter.MIN_PRIORITY_WEIGHTING and Converter.MAX_PRIORITY_WEIGHTING.

setPriorityWeighting

public void setPriorityWeighting(int priorityWeighting)
Description copied from interface: Converter
If 2 or more discoverable transformers are equal, this value can be used to select the correct one

Specified by:
setPriorityWeighting in interface Converter
Parameters:
priorityWeighting - the priority weighting for this transformer. This is a value between Converter.MIN_PRIORITY_WEIGHTING and Converter.MAX_PRIORITY_WEIGHTING.


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