public class JSONWrappedObject extends java.lang.Object implements JsonSerializable
JSONPObject
JsonSerializable.Base
Modifier and Type | Field and Description |
---|---|
protected java.lang.String |
_prefix
Literal String to output before serialized value.
|
protected JavaType |
_serializationType
Optional static type to use for serialization; if null, runtime
type is used.
|
protected java.lang.String |
_suffix
Literal String to output after serialized value.
|
protected java.lang.Object |
_value
Value to be serialized as JSONP padded; can be null.
|
Constructor and Description |
---|
JSONWrappedObject(java.lang.String prefix,
java.lang.String suffix,
java.lang.Object value) |
JSONWrappedObject(java.lang.String prefix,
java.lang.String suffix,
java.lang.Object value,
JavaType asType)
Constructor that should be used when specific serialization type to use
is important, and needs to be passed instead of just using runtime
(type-erased) type of the value.
|
Modifier and Type | Method and Description |
---|---|
java.lang.String |
getPrefix() |
JavaType |
getSerializationType() |
java.lang.String |
getSuffix() |
java.lang.Object |
getValue() |
void |
serialize(com.fasterxml.jackson.core.JsonGenerator jgen,
SerializerProvider provider)
Serialization method called when no additional type information is
to be included in serialization.
|
void |
serializeWithType(com.fasterxml.jackson.core.JsonGenerator jgen,
SerializerProvider provider,
TypeSerializer typeSer)
Serialization method called when additional type information is
expected to be included in serialization, for deserialization to use.
|
protected final java.lang.String _prefix
protected final java.lang.String _suffix
protected final java.lang.Object _value
protected final JavaType _serializationType
public JSONWrappedObject(java.lang.String prefix, java.lang.String suffix, java.lang.Object value)
public JSONWrappedObject(java.lang.String prefix, java.lang.String suffix, java.lang.Object value, JavaType asType)
public void serializeWithType(com.fasterxml.jackson.core.JsonGenerator jgen, SerializerProvider provider, TypeSerializer typeSer) throws java.io.IOException, com.fasterxml.jackson.core.JsonProcessingException
JsonSerializable
Usually implementation consists of a call to one of methods
in TypeSerializer
(such as TypeSerializer.writeTypePrefixForObject(Object, JsonGenerator)
)
followed by serialization of contents,
followed by another call to TypeSerializer
(such as TypeSerializer.writeTypeSuffixForObject(Object, JsonGenerator)
).
Exact methods to call in TypeSerializer
depend on shape of JSON Object used
(Array, Object or scalar like String/Number/Boolean).
Note that some types (most notably, "natural" types: String, Integer, Double and Boolean) never include type information.
serializeWithType
in interface JsonSerializable
java.io.IOException
com.fasterxml.jackson.core.JsonProcessingException
public void serialize(com.fasterxml.jackson.core.JsonGenerator jgen, SerializerProvider provider) throws java.io.IOException, com.fasterxml.jackson.core.JsonProcessingException
JsonSerializable
serialize
in interface JsonSerializable
java.io.IOException
com.fasterxml.jackson.core.JsonProcessingException
public java.lang.String getPrefix()
public java.lang.String getSuffix()
public java.lang.Object getValue()
public JavaType getSerializationType()