public class ObjectSerializer extends JavaTypeSerializer<java.lang.Object>
Object parameters.
At parse, the string representation of this instance is always returned.
At serialization, the instance's serializer is obtained via JavaTypeSerializer.getSerializer(java.lang.String), and
the serialization is delegated to it.
| Modifier and Type | Field and Description |
|---|---|
private com.fasterxml.jackson.databind.ObjectMapper |
mapper
The object mapper to (de)serialize the instance.
|
BIGDECIMAL_SERIALIZER, BIGINTEGER_SERIALIZER, BOOLEAN_SERIALIZER, BYTEARRAY_SERIALIZER, DOUBLE_SERIALIZER, FLOAT_SERIALIZER, INTEGER_SERIALIZER, LONG_SERIALIZER, SHORT_SERIALIZER, STRING_SERIALIZER| Constructor and Description |
|---|
ObjectSerializer()
Initialize this serializer with the given type.
|
| Modifier and Type | Method and Description |
|---|---|
java.lang.Object |
fromJson(java.lang.Object arg,
java.lang.String sval)
Deserializes the JSON representation into a new instance of the argument's type.
|
java.lang.Object |
initialize(java.lang.Class<? extends java.lang.Object> definitionType)
Create an initial (default) instance for this serializer.
|
com.fasterxml.jackson.databind.JsonNode |
toJson(java.lang.Object val)
Serialize the given instance to JSON, using the
mapper. |
bootstrap, fromJson, getSerializer, getSerializer, getType, newInstance, newRecord, readArray, readArray, readArray, readMap, resolveJavaType, toJsonArray, toJsonObjectprivate final com.fasterxml.jackson.databind.ObjectMapper mapper
public ObjectSerializer()
public java.lang.Object initialize(java.lang.Class<? extends java.lang.Object> definitionType)
throws java.lang.InstantiationException,
java.lang.IllegalAccessException,
java.lang.IllegalArgumentException,
java.lang.reflect.InvocationTargetException,
java.lang.NoSuchMethodException,
java.lang.SecurityException
For this serializer, it creates a new instance of that type - a default constructor must be available.
initialize in class JavaTypeSerializer<java.lang.Object>definitionType - The type as it appears at the parameter's definition.java.lang.SecurityExceptionjava.lang.NoSuchMethodExceptionjava.lang.reflect.InvocationTargetExceptionjava.lang.IllegalArgumentExceptionjava.lang.InstantiationExceptionjava.lang.IllegalAccessExceptionpublic java.lang.Object fromJson(java.lang.Object arg,
java.lang.String sval)
throws RequestArgumentError
fromJson in class JavaTypeSerializer<java.lang.Object>arg - The argument (obtained via initialize(java.lang.Class<? extends java.lang.Object>).sval - The string JSON representation of this argument.RequestArgumentError - If the argument can't be parsed.public com.fasterxml.jackson.databind.JsonNode toJson(java.lang.Object val)
mapper.toJson in class JavaTypeSerializer<java.lang.Object>val - The instance to serialize.