org.codehaus.jackson.map.util
Class JSONPObject
java.lang.Object
org.codehaus.jackson.map.util.JSONPObject
- All Implemented Interfaces:
- JsonSerializable, JsonSerializableWithType
public class JSONPObject
- extends Object
- implements JsonSerializableWithType
Container class that can be used to wrap any Object instances (including
nulls), and will serialize embedded in
JSONP wrapping.
- Since:
- 1.5
- Author:
- tatu
- See Also:
JSONWrappedObject
Field Summary |
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. |
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
_function
protected final String _function
- JSONP function name to use for serialization
_value
protected final Object _value
- Value to be serialized as JSONP padded; can be null.
_serializationType
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).
JSONPObject
public JSONPObject(String function,
Object value)
JSONPObject
public JSONPObject(String function,
Object value,
JavaType asType)
JSONPObject
public JSONPObject(String function,
Object value,
Class<?> rawType)
serializeWithType
public void serializeWithType(JsonGenerator jgen,
SerializerProvider provider,
TypeSerializer typeSer)
throws IOException,
JsonProcessingException
- Specified by:
serializeWithType
in interface JsonSerializableWithType
- Throws:
IOException
JsonProcessingException
serialize
public void serialize(JsonGenerator jgen,
SerializerProvider provider)
throws IOException,
JsonProcessingException
- Specified by:
serialize
in interface JsonSerializable
- Throws:
IOException
JsonProcessingException
getFunction
public String getFunction()
getValue
public Object getValue()
getSerializationType
public JavaType getSerializationType()