public class JSONPObject extends Object implements JsonSerializable
JSONWrappedObject
Modifier and Type | Field and Description |
---|---|
protected String |
_function
JSONP function name to use for serialization
|
protected JavaType |
_serializationType
Optional static type to use for serialization; if null, runtime
type is used.
|
protected Object |
_value
Value to be serialized as JSONP padded; can be null.
|
Constructor and Description |
---|
JSONPObject(String function,
Object value) |
JSONPObject(String function,
Object value,
JavaType asType) |
Modifier and Type | Method and Description |
---|---|
String |
getFunction() |
JavaType |
getSerializationType() |
Object |
getValue() |
void |
serialize(JsonGenerator jgen,
SerializerProvider provider)
Serialization method called when no additional type information is
to be included in serialization.
|
void |
serializeWithType(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 String _function
protected final Object _value
protected final JavaType _serializationType
public void serializeWithType(JsonGenerator jgen, SerializerProvider provider, TypeSerializer typeSer) throws IOException, 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
IOException
JsonProcessingException
public void serialize(JsonGenerator jgen, SerializerProvider provider) throws IOException, JsonProcessingException
JsonSerializable
serialize
in interface JsonSerializable
IOException
JsonProcessingException
public String getFunction()
public Object getValue()
public JavaType getSerializationType()
Copyright © 2014 FasterXML. All Rights Reserved.