Did this page help you?

   Yes   No   Tell us about it...

com.amazonaws.services.simpleworkflow.flow
Class JsonDataConverter

java.lang.Object
  extended by com.amazonaws.services.simpleworkflow.flow.DataConverter
      extended by com.amazonaws.services.simpleworkflow.flow.JsonDataConverter

public class JsonDataConverter
extends DataConverter

Implements conversion through Jackson JSON processor. Consult its documentation on how to ensure that classes are serializable, configure their serialization through annotations and ObjectMapper parameters.

Note that default configuration used by this class includes class name of the every serialized value into the produced JSON. It is done to support polymorphic types out of the box. But in some cases it might be beneficial to disable polymorphic support as it produces much more concise and portable output.


Constructor Summary
JsonDataConverter()
          Create instance of the converter that uses ObjectMapper with Feature#FAIL_ON_UNKNOWN_PROPERTIES set to false and default typing set to ObjectMapper.DefaultTyping.NON_FINAL.
JsonDataConverter(org.codehaus.jackson.map.ObjectMapper mapper)
          Create instance of the converter that uses ObjectMapper configured externally.
 
Method Summary
<T> T
fromData(String serialized, Class<T> valueType)
          Implements conversion of the single value.
 String toData(Object value)
          Implements conversion of the single value.
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

JsonDataConverter

public JsonDataConverter()
Create instance of the converter that uses ObjectMapper with Feature#FAIL_ON_UNKNOWN_PROPERTIES set to false and default typing set to ObjectMapper.DefaultTyping.NON_FINAL.


JsonDataConverter

public JsonDataConverter(org.codehaus.jackson.map.ObjectMapper mapper)
Create instance of the converter that uses ObjectMapper configured externally.

Method Detail

toData

public String toData(Object value)
              throws DataConverterException
Description copied from class: DataConverter
Implements conversion of the single value.

Specified by:
toData in class DataConverter
Parameters:
value - Java value to convert to String.
Returns:
converted value
Throws:
DataConverterException - if conversion of the value passed as parameter failed for any reason.

fromData

public <T> T fromData(String serialized,
                      Class<T> valueType)
           throws DataConverterException
Description copied from class: DataConverter
Implements conversion of the single value.

Specified by:
fromData in class DataConverter
Returns:
converted Java object
Throws:
DataConverterException - if conversion of the data passed as parameter failed for any reason.


Copyright © 2010 Amazon Web Services, Inc. All Rights Reserved.