Overview | Package | Class | Use | Tree | Deprecated | Index | Help
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD

## com.fasterxml.jackson.databind.util
Class JSONPObject

    java.lang.Object
      com.fasterxml.jackson.databind.util.JSONPObject

All Implemented Interfaces:
  JsonSerializable

    public class JSONPObject

extends Object
implements JsonSerializable

Container class that can be used to wrap any Object instances (including nulls), and will serialize embedded in JSONP wrapping.

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.

Constructor Summary
`JSONPObject(String function, Object value)`
`JSONPObject(String function, Object value, JavaType asType)`

Method Summary
`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.

Methods inherited from class java.lang.Object
`clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

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

    public JSONPObject(String function,
                       Object value)

### JSONPObject

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

Method Detail

### serializeWithType

    public void serializeWithType(JsonGenerator jgen,
                                  SerializerProvider provider,
                                  TypeSerializer typeSer)
                           throws IOException,
                                  JsonProcessingException

  Description copied from interface: `JsonSerializable`
  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 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.

  Specified by:
    `serializeWithType` in interface `JsonSerializable`
  Throws:
    `IOException`
    `JsonProcessingException`

### serialize

    public void serialize(JsonGenerator jgen,
                          SerializerProvider provider)
                   throws IOException,
                          JsonProcessingException

  Description copied from interface: `JsonSerializable`
  Serialization method called when no additional type information is to be included in serialization.

  Specified by:
    `serialize` in interface `JsonSerializable`
  Throws:
    `IOException`
    `JsonProcessingException`

### getFunction

    public String getFunction()

### getValue

    public Object getValue()

### getSerializationType

    public JavaType getSerializationType()

Overview | Package | Class | Use | Tree | Deprecated | Index | Help
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD

Copyright © 2012 FasterXML. All Rights Reserved.