public class PojoSerializer extends JavaTypeSerializer<PojoType>
Modifier and Type | Field and Description |
---|---|
private static java.util.Map<java.lang.Class<? extends PojoType>,java.util.Map<java.lang.String,java.lang.reflect.Method[]>> |
PROPERTY_CACHE
A cache of getter/setter methods for each
PojoType , by their Java field names. |
BIGDECIMAL_SERIALIZER, BIGINTEGER_SERIALIZER, BOOLEAN_SERIALIZER, BYTEARRAY_SERIALIZER, DOUBLE_SERIALIZER, FLOAT_SERIALIZER, INTEGER_SERIALIZER, LONG_SERIALIZER, mapper, SHORT_SERIALIZER, STRING_SERIALIZER
Constructor and Description |
---|
PojoSerializer()
Create a new serializer for
PojoType type. |
Modifier and Type | Method and Description |
---|---|
PojoType |
fromJson(PojoType arg,
java.lang.String sval)
Parse the string JSON representation and assign it to the given argument.
|
private java.util.Map<java.lang.String,java.lang.reflect.Method[]> |
getProperties(java.lang.Class<? extends PojoType> clazz)
Resolve the POJO serializable properties for the given type.
|
PojoType |
initialize(java.lang.Class<? extends PojoType> definitionType)
Create an initial (default) instance for this serializer.
|
com.fasterxml.jackson.databind.JsonNode |
toJson(PojoType val)
Serialize the given instance to JSON.
|
fromJson, getSerializer, getSerializer, getType, newInstance, newRecord, readArray, readArray, readArray, readMap, resolveJavaType, toJsonArray, toJsonObject
public PojoSerializer()
PojoType
type.public PojoType initialize(java.lang.Class<? extends PojoType> definitionType) throws java.lang.InstantiationException, java.lang.IllegalAccessException
initialize
in class JavaTypeSerializer<PojoType>
definitionType
- The type as it appears at the parameter's definition.java.lang.InstantiationException
java.lang.IllegalAccessException
public PojoType fromJson(PojoType arg, java.lang.String sval) throws RequestArgumentError
fromJson
in class JavaTypeSerializer<PojoType>
arg
- The argument (obtained via initialize(java.lang.Class<? extends com.goldencode.p2j.rest.serializers.PojoType>)
.sval
- The string JSON representation of this argument.RequestArgumentError
- If the argument can't be parsed.public com.fasterxml.jackson.databind.JsonNode toJson(PojoType val)
toJson
in class JavaTypeSerializer<PojoType>
val
- The instance to serialize.private java.util.Map<java.lang.String,java.lang.reflect.Method[]> getProperties(java.lang.Class<? extends PojoType> clazz)
clazz
- The POJO type.