Class RawValue

java.lang.Object
tools.jackson.databind.util.RawValue
All Implemented Interfaces:
JacksonSerializable

public class RawValue extends Object implements JacksonSerializable
Helper class used to encapsulate "raw values", pre-encoded textual content that can be output as opaque value with no quoting/escaping, using JsonGenerator.writeRawValue(String). It may be stored in TokenBuffer, as well as in Tree Model (JsonNode)
  • Field Details

    • _value

      protected Object _value
      Contents to serialize. Untyped because there are multiple types that are supported: String, JacksonSerializable, SerializableString.
  • Constructor Details

    • RawValue

      public RawValue(String v)
    • RawValue

      public RawValue(tools.jackson.core.SerializableString v)
    • RawValue

      public RawValue(JacksonSerializable v)
    • RawValue

      protected RawValue(Object value, boolean bogus)
      Constructor that may be used by sub-classes, and allows passing value types other than ones for which explicit constructor exists. Caller has to take care that values of types not supported by base implementation are handled properly, usually by overriding some of existing serialization methods.
  • Method Details

    • rawValue

      public Object rawValue()
      Accessor for returning enclosed raw value in whatever form it was created in (usually String, {link SerializableString}, or any JacksonSerializable).
    • serialize

      public void serialize(tools.jackson.core.JsonGenerator gen, SerializationContext serializers) throws tools.jackson.core.JacksonException
      Description copied from interface: JacksonSerializable
      Serialization method called when no additional type information is to be included in serialization.
      Specified by:
      serialize in interface JacksonSerializable
      Throws:
      tools.jackson.core.JacksonException
    • serializeWithType

      public void serializeWithType(tools.jackson.core.JsonGenerator gen, SerializationContext serializers, TypeSerializer typeSer) throws tools.jackson.core.JacksonException
      Description copied from interface: JacksonSerializable
      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 TypeSerializer.writeTypePrefix(JsonGenerator, SerializationContext, WritableTypeId) followed by serialization of contents, followed by a call to TypeSerializer.writeTypeSuffix(JsonGenerator, SerializationContext, WritableTypeId)). Details of the type id argument to pass 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 JacksonSerializable
      Throws:
      tools.jackson.core.JacksonException
    • serialize

      public void serialize(tools.jackson.core.JsonGenerator gen) throws tools.jackson.core.JacksonException
      Throws:
      tools.jackson.core.JacksonException
    • _serialize

      protected void _serialize(tools.jackson.core.JsonGenerator gen) throws tools.jackson.core.JacksonException
      Throws:
      tools.jackson.core.JacksonException
    • equals

      public boolean equals(Object o)
      Overrides:
      equals in class Object
    • hashCode

      public int hashCode()
      Overrides:
      hashCode in class Object
    • toString

      public String toString()
      Overrides:
      toString in class Object