public class RecordSerializer extends JavaTypeSerializer<DataModelObject>
DataModelObject instances.BIGDECIMAL_SERIALIZER, BIGINTEGER_SERIALIZER, BOOLEAN_SERIALIZER, BYTEARRAY_SERIALIZER, DOUBLE_SERIALIZER, FLOAT_SERIALIZER, INTEGER_SERIALIZER, LONG_SERIALIZER, mapper, SHORT_SERIALIZER, STRING_SERIALIZER| Constructor and Description |
|---|
RecordSerializer()
Create a new serializer for
DataModelObject type. |
| Modifier and Type | Method and Description |
|---|---|
DataModelObject |
fromJson(DataModelObject arg,
java.lang.String sval)
Parse the string JSON representation and assign it to the given argument.
|
DataModelObject |
initialize(java.lang.Class<? extends DataModelObject> definitionType)
Create an initial (default) instance for this serializer.
|
com.fasterxml.jackson.databind.JsonNode |
toJson(DataModelObject val)
Serialize the given instance to JSON.
|
bootstrap, fromJson, getSerializer, getSerializer, getType, newInstance, newRecord, readArray, readArray, readArray, readMap, resolveJavaType, toJsonArray, toJsonObjectpublic RecordSerializer()
DataModelObject type.public DataModelObject initialize(java.lang.Class<? extends DataModelObject> definitionType) throws java.lang.ReflectiveOperationException
this will create a new record of the given type and initialize its fields with the default values.
initialize in class JavaTypeSerializer<DataModelObject>definitionType - The type as it appears at the parameter's definition.null for immutable types, a Java native value for native types or a new instance,
for mutable types.java.lang.ReflectiveOperationExceptionjava.lang.InstantiationExceptionjava.lang.IllegalAccessExceptionpublic DataModelObject fromJson(DataModelObject arg, java.lang.String sval) throws RequestArgumentError
fromJson in class JavaTypeSerializer<DataModelObject>arg - The argument (obtained via initialize(java.lang.Class<? extends com.goldencode.p2j.persist.DataModelObject>).sval - The string JSON representation of this argument.RequestArgumentError - If the argument can't be parsed.public com.fasterxml.jackson.databind.JsonNode toJson(DataModelObject val)
The JSON object will have as keys the record's legacy field names, case-sensitive.
toJson in class JavaTypeSerializer<DataModelObject>val - The instance to serialize.