org.codehaus.jackson.map.util

## Class JSONWrappedObject

- java.lang.Object
- - org.codehaus.jackson.map.util.JSONWrappedObject

- All Implemented Interfaces:
    JsonSerializable, JsonSerializableWithType

      public class JSONWrappedObject
      extends Object
      implements JsonSerializableWithType

  General-purpose wrapper class that can be used to decorate serialized value with arbitrary literal prefix and suffix. This can be used for example to construct arbitrary Javascript values (similar to how basic function name and parenthesis are used with JSONP).
  Since:
    1.5
  Author:
    tatu
  See Also:
    `JSONPObject`

- - ### Field Summary

    Fields
    Modifier and Type | Field and Description
    --- | ---
    `protected String` | `_prefix` Literal String to output before serialized value.
    `protected JavaType` | `_serializationType` Optional static type to use for serialization; if null, runtime type is used.
    `protected String` | `_suffix` Literal String to output after serialized value.
    `protected Object` | `_value` Value to be serialized as JSONP padded; can be null.

  - ### Constructor Summary

    Constructors
    Constructor and Description
    `JSONWrappedObject(String prefix, String suffix, Object value)`
    `JSONWrappedObject(String prefix, String suffix, Object value, Class<?> rawType)` Deprecated. Since 1.8; should construct with resolved `JavaType`, to ensure type has been properly resolved
    `JSONWrappedObject(String prefix, String suffix, Object value, JavaType asType)`

  - ### Method Summary

    Methods
    Modifier and Type | Method and Description
    --- | ---
    `String` | `getPrefix()`
    `JavaType` | `getSerializationType()`
    `String` | `getSuffix()`
    `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

    - #### _prefix

          protected final String _prefix

      Literal String to output before serialized value. Will not be quoted when serializing value.

    - #### _suffix

          protected final String _suffix

      Literal String to output after serialized value. Will not be quoted when serializing value.

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

    - #### JSONWrappedObject

          public JSONWrappedObject(String prefix,
                           String suffix,
                           Object value)

    - #### JSONWrappedObject

          public JSONWrappedObject(String prefix,
                           String suffix,
                           Object value,
                           JavaType asType)

    - #### JSONWrappedObject

          @Deprecated
          public JSONWrappedObject(String prefix,
                                      String suffix,
                                      Object value,
                                      Class<?> rawType)

      Deprecated. Since 1.8; should construct with resolved `JavaType`, to ensure type has been 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`

    - #### getPrefix

          public String getPrefix()

    - #### getSuffix

          public String getSuffix()

    - #### getValue

          public Object getValue()

    - #### getSerializationType

          public JavaType getSerializationType()