public class JsonMarshaller<T> extends java.lang.Object implements DynamoDBMarshaller<T>
Modifier and Type | Field and Description |
---|---|
private static com.fasterxml.jackson.databind.ObjectMapper |
mapper |
private java.lang.Class<T> |
valueType
The value type.
|
private static com.fasterxml.jackson.databind.ObjectWriter |
writer |
Constructor and Description |
---|
JsonMarshaller()
Constructs the JSON marshaller instance.
|
JsonMarshaller(java.lang.Class<T> valueType)
Constructs the JSON marshaller instance.
|
Modifier and Type | Method and Description |
---|---|
protected java.lang.Class<T> |
getValueType()
Gets the value type.
|
java.lang.String |
marshall(T obj)
Turns an object of type T into its String representation.
|
T |
unmarshall(java.lang.Class<T> clazz,
java.lang.String json)
Turns a String representation of an object of type T into an object.
|
private static final com.fasterxml.jackson.databind.ObjectMapper mapper
private static final com.fasterxml.jackson.databind.ObjectWriter writer
private final java.lang.Class<T> valueType
public JsonMarshaller(java.lang.Class<T> valueType)
valueType
- The value type (for generic type erasure).public JsonMarshaller()
protected final java.lang.Class<T> getValueType()
public java.lang.String marshall(T obj)
DynamoDBMarshaller
marshall
in interface DynamoDBMarshaller<T>
public T unmarshall(java.lang.Class<T> clazz, java.lang.String json)
DynamoDBMarshaller
unmarshall
in interface DynamoDBMarshaller<T>