Top Description Fields Constructors Methods
com.fasterxml.jackson.databind.util

public Class JSONPObject

extends Object
implements JsonSerializable
Class Inheritance
All Implemented Interfaces
com.fasterxml.jackson.databind.JsonSerializable
Imports
java.io.IOException, com.fasterxml.jackson.core.*, com.fasterxml.jackson.databind.*, com.fasterxml.jackson.databind.jsontype.TypeSerializer

Container class that can be used to wrap any Object instances (including nulls), and will serialize embedded in JSONP wrapping.
See Also
com.fasterxml.jackson.databind.util.JSONWrappedObject

Field Summary

Modifier and TypeField and Description
protected final String
_function

JSONP function name to use for serialization

protected final JavaType
_serializationType

Optional static type to use for serialization; if null, runtime type is used.

protected final Object
_value

Value to be serialized as JSONP padded; can be null.

Constructor Summary

AccessConstructor and Description
public
JSONPObject(String function, Object value)

public
JSONPObject(String function, Object value, JavaType asType)

Method Summary

Modifier and TypeMethod and Description
public String
public JavaType
public Object
public void
serialize(JsonGenerator gen, SerializerProvider provider)

Implements com.fasterxml.jackson.databind.JsonSerializable.serialize.

Serialization method called when no additional type information is to be included in serialization.

public void
serializeWithType(JsonGenerator gen, SerializerProvider provider, TypeSerializer typeSer)

Implements com.fasterxml.jackson.databind.JsonSerializable.serializeWithType.

Serialization method called when additional type information is expected to be included in serialization, for deserialization to use.

Inherited from java.lang.Object:
cloneequalsfinalizegetClasshashCodenotifynotifyAlltoStringwaitwaitwait

Field Detail

_functionback to summary
protected final String _function

JSONP function name to use for serialization

_serializationTypeback to summary
protected final JavaType _serializationType

Optional static type to use for serialization; if null, runtime type is used. Can be used to specify declared type which defines serializer to use, as well as aspects of extra type information to include (if any).

_valueback to summary
protected final Object _value

Value to be serialized as JSONP padded; can be null.

Constructor Detail

JSONPObjectback to summary
public JSONPObject(String function, Object value)
JSONPObjectback to summary
public JSONPObject(String function, Object value, JavaType asType)

Method Detail

getFunctionback to summary
public String getFunction()
getSerializationTypeback to summary
public JavaType getSerializationType()
getValueback to summary
public Object getValue()
serializeback to summary
public void serialize(JsonGenerator gen, SerializerProvider provider) throws IOException

Implements com.fasterxml.jackson.databind.JsonSerializable.serialize.

Doc from com.fasterxml.jackson.databind.JsonSerializable.serialize.

Serialization method called when no additional type information is to be included in serialization.

Annotations
@Override
serializeWithTypeback to summary
public void serializeWithType(JsonGenerator gen, SerializerProvider provider, TypeSerializer typeSer) throws IOException

Implements com.fasterxml.jackson.databind.JsonSerializable.serializeWithType.

Doc from com.fasterxml.jackson.databind.JsonSerializable.serializeWithType.

Serialization method called when additional type information is expected to be included in serialization, for deserialization to use.

Usually implementation consists of a call to TypeSerializer#writeTypePrefix followed by serialization of contents, followed by a call to TypeSerializer#writeTypeSuffix). Details of the type id argument to pass 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.

Annotations
@Override