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 and Description
    --- | ---
    `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

    Constructors
    Constructor and 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 resolved
    `JSONPObject(String function, Object value, JavaType asType)`

  - ### Method Summary

    Methods
    Modifier and Type | Method and Description
    --- | ---
    `String` | `getFunction()`
    `JavaType` | `getSerializationType()`
    `Object` | `getValue()`
    `void` | `serialize(JsonGenerator jgen, SerializerProvider provider)`
    `void` | `serializeWithType(JsonGenerator jgen, SerializerProvider provider, TypeSerializer typeSer)`

    - ### 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)

    - #### 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 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()