Package 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 java.lang.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
Fields Modifier and Type Field Description protected java.lang.String
_function
JSONP function name to use for serializationprotected JavaType
_serializationType
Optional static type to use for serialization; if null, runtime type is used.protected java.lang.Object
_value
Value to be serialized as JSONP padded; can be null.
-
Constructor Summary
Constructors Constructor Description JSONPObject(java.lang.String function, java.lang.Object value)
JSONPObject(java.lang.String function, java.lang.Object value, java.lang.Class<?> rawType)
Deprecated.Since 1.8; instead use variant that takes JavaType: this ensures that type information is properly resolvedJSONPObject(java.lang.String function, java.lang.Object value, JavaType asType)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description java.lang.String
getFunction()
JavaType
getSerializationType()
java.lang.Object
getValue()
void
serialize(JsonGenerator jgen, SerializerProvider provider)
void
serializeWithType(JsonGenerator jgen, SerializerProvider provider, TypeSerializer typeSer)
-
-
-
Field Detail
-
_function
protected final java.lang.String _function
JSONP function name to use for serialization
-
_value
protected final java.lang.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).
-
-
Constructor Detail
-
JSONPObject
public JSONPObject(java.lang.String function, java.lang.Object value)
-
JSONPObject
public JSONPObject(java.lang.String function, java.lang.Object value, JavaType asType)
-
JSONPObject
@Deprecated public JSONPObject(java.lang.String function, java.lang.Object value, java.lang.Class<?> rawType)
Deprecated.Since 1.8; instead use variant that takes JavaType: this ensures that type information is properly resolved
-
-
Method Detail
-
serializeWithType
public void serializeWithType(JsonGenerator jgen, SerializerProvider provider, TypeSerializer typeSer) throws java.io.IOException, JsonProcessingException
- Specified by:
serializeWithType
in interfaceJsonSerializableWithType
- Throws:
java.io.IOException
JsonProcessingException
-
serialize
public void serialize(JsonGenerator jgen, SerializerProvider provider) throws java.io.IOException, JsonProcessingException
- Specified by:
serialize
in interfaceJsonSerializable
- Throws:
java.io.IOException
JsonProcessingException
-
getFunction
public java.lang.String getFunction()
-
getValue
public java.lang.Object getValue()
-
getSerializationType
public JavaType getSerializationType()
-
-