Class JSONWrappedObject

  • All Implemented Interfaces:
    JsonSerializable, JsonSerializableWithType

    public class JSONWrappedObject
    extends java.lang.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 Description
      protected java.lang.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 java.lang.String _suffix
      Literal String to output after serialized value.
      protected java.lang.Object _value
      Value to be serialized as JSONP padded; can be null.
    • Constructor Summary

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

      • _prefix

        protected final java.lang.String _prefix
        Literal String to output before serialized value. Will not be quoted when serializing value.
      • _suffix

        protected final java.lang.String _suffix
        Literal String to output after serialized value. Will not be quoted when serializing value.
      • _value

        protected final java.lang.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​(java.lang.String prefix,
                                 java.lang.String suffix,
                                 java.lang.Object value)
      • JSONWrappedObject

        public JSONWrappedObject​(java.lang.String prefix,
                                 java.lang.String suffix,
                                 java.lang.Object value,
                                 JavaType asType)
      • JSONWrappedObject

        @Deprecated
        public JSONWrappedObject​(java.lang.String prefix,
                                 java.lang.String suffix,
                                 java.lang.Object value,
                                 java.lang.Class<?> rawType)
        Deprecated.
        Since 1.8; should construct with resolved JavaType, to ensure type has been properly resolved