class ArraySerializer extends JavaTypeSerializer<java.lang.Object>
Modifier and Type | Field and Description |
---|---|
private JavaTypeSerializer |
component
The array's component serializer.
|
private int |
extent
The array's length.
|
BIGDECIMAL_SERIALIZER, BIGINTEGER_SERIALIZER, BOOLEAN_SERIALIZER, BYTEARRAY_SERIALIZER, DOUBLE_SERIALIZER, FLOAT_SERIALIZER, INTEGER_SERIALIZER, LONG_SERIALIZER, mapper, SHORT_SERIALIZER, STRING_SERIALIZER
Constructor and Description |
---|
ArraySerializer(ArraySerializer serializer,
int extent)
Create a copy of the given array serializer, and set its length.
|
ArraySerializer(java.lang.Class<java.lang.Object> type,
JavaTypeSerializer ctype)
Create a new serializer and parser for the given type.
|
Modifier and Type | Method and Description |
---|---|
java.lang.Object |
fromJson(java.lang.Object arg,
java.lang.String sval)
Parse the string JSON representation and assign it to the given argument.
|
java.lang.Object |
initialize(java.lang.Class<?> 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.
|
fromJson, getSerializer, getSerializer, getType, newInstance, newRecord, readArray, readArray, readArray, readMap, resolveJavaType, toJsonArray, toJsonObject
private final JavaTypeSerializer component
private final int extent
public ArraySerializer(java.lang.Class<java.lang.Object> type, JavaTypeSerializer ctype)
type
- The component type.ctype
- The component serializer.public ArraySerializer(ArraySerializer serializer, int extent)
serializer
- The initial instance.extent
- The array's length.public java.lang.Object initialize(java.lang.Class<?> definitionType)
The array's length will be either zero or the extent
, if non-negative.
initialize
in class JavaTypeSerializer<java.lang.Object>
definitionType
- The type as it appears at the parameter's definition.public 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<?>)
.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)
toJson
in class JavaTypeSerializer<java.lang.Object>
val
- The instance to serialize.