Class JSONWrappedObject

java.lang.Object
com.fasterxml.jackson.databind.util.JSONWrappedObject
All Implemented Interfaces:
JsonSerializable

public class JSONWrappedObject extends Object implements JsonSerializable
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).
See Also:
  • Field Details

    • _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 Details

    • JSONWrappedObject

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

      public JSONWrappedObject(String prefix, String suffix, Object value, JavaType asType)
      Constructor that should be used when specific serialization type to use is important, and needs to be passed instead of just using runtime (type-erased) type of the value.
  • Method Details