com.fasterxml.jackson.databind.util

## Class RawValue

- java.lang.Object
- - com.fasterxml.jackson.databind.util.RawValue

- All Implemented Interfaces:
    JsonSerializable

      public class RawValue
      extends Object
      implements JsonSerializable

  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`)
  Since:
    2.6

- - ### Nested Class Summary

    - ### Nested classes/interfaces inherited from interface com.fasterxml.jackson.databind.JsonSerializable

      `JsonSerializable.Base`

  - ### Field Summary

    Fields
    Modifier and Type | Field and Description
    --- | ---
    `protected Object` | `_value` Contents to serialize.

  - ### Constructor Summary

    Constructors
    Modifier | Constructor and Description
    --- | ---
    `` | `RawValue(JsonSerializable v)`
    `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.
    `` | `RawValue(SerializableString v)`
    `` | `RawValue(String v)`

  - ### Method Summary

    Methods
    Modifier and Type | Method and Description
    --- | ---
    `protected void` | `_serialize(JsonGenerator gen)`
    `boolean` | `equals(Object o)`
    `int` | `hashCode()`
    `Object` | `rawValue()` Accessor for returning enclosed raw value in whatever form it was created in (usually `String`, {link SerializableString}, or any `JsonSerializable`).
    `void` | `serialize(JsonGenerator gen)`
    `void` | `serialize(JsonGenerator gen, SerializerProvider serializers)` Serialization method called when no additional type information is to be included in serialization.
    `void` | `serializeWithType(JsonGenerator gen, SerializerProvider serializers, TypeSerializer typeSer)` Serialization method called when additional type information is expected to be included in serialization, for deserialization to use.
    `String` | `toString()`

    - ### Methods inherited from class java.lang.Object

      `clone, finalize, getClass, notify, notifyAll, wait, wait, wait`

- - ### Field Detail

    - #### _value

          protected Object _value

      Contents to serialize. Untyped because there are multiple types that are supported: `String`, `JsonSerializable`, `SerializableString`.

  - ### Constructor Detail

    - #### RawValue

          public RawValue(String v)

    - #### RawValue

          public RawValue(SerializableString v)

    - #### RawValue

          public RawValue(JsonSerializable 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 Detail

    - #### rawValue

          public Object rawValue()

      Accessor for returning enclosed raw value in whatever form it was created in (usually `String`, {link SerializableString}, or any `JsonSerializable`).

    - #### serialize

          public void serialize(JsonGenerator gen,
                       SerializerProvider serializers)
                         throws IOException

      Description copied from interface: `JsonSerializable`
      Serialization method called when no additional type information is to be included in serialization.
      Specified by:
        `serialize` in interface `JsonSerializable`
      Throws:
        `IOException`

    - #### serializeWithType

          public void serializeWithType(JsonGenerator gen,
                               SerializerProvider serializers,
                               TypeSerializer typeSer)
                                 throws IOException

      Description copied from interface: `JsonSerializable`
      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 one of methods in `TypeSerializer` (such as `TypeSerializer.writeTypePrefixForObject(Object, JsonGenerator)`) followed by serialization of contents, followed by another call to `TypeSerializer` (such as `TypeSerializer.writeTypeSuffixForObject(Object, JsonGenerator)`). Exact methods to call in `TypeSerializer` 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 `JsonSerializable`
      Throws:
        `IOException`

    - #### serialize

          public void serialize(JsonGenerator gen)
                         throws IOException

      Throws:
        `IOException`

    - #### _serialize

          protected void _serialize(JsonGenerator gen)
                             throws IOException

      Throws:
        `IOException`

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

Copyright © 2008–2016 FasterXML. All rights reserved.