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