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, usingJsonGenerator.writeRawValue(String). It may be stored inTokenBuffer, 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
-
-
Constructor Summary
Constructors Modifier Constructor Description RawValue(com.fasterxml.jackson.core.SerializableString v)RawValue(JsonSerializable v)protectedRawValue(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(String v)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description protected void_serialize(com.fasterxml.jackson.core.JsonGenerator gen)booleanequals(Object o)inthashCode()ObjectrawValue()Accessor for returning enclosed raw value in whatever form it was created in (usuallyString, {link SerializableString}, or anyJsonSerializable).voidserialize(com.fasterxml.jackson.core.JsonGenerator gen)voidserialize(com.fasterxml.jackson.core.JsonGenerator gen, SerializerProvider serializers)Serialization method called when no additional type information is to be included in serialization.voidserializeWithType(com.fasterxml.jackson.core.JsonGenerator gen, SerializerProvider serializers, TypeSerializer typeSer)Serialization method called when additional type information is expected to be included in serialization, for deserialization to use.StringtoString()
-
-
-
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(com.fasterxml.jackson.core.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 (usuallyString, {link SerializableString}, or anyJsonSerializable).
-
serialize
public void serialize(com.fasterxml.jackson.core.JsonGenerator gen, SerializerProvider serializers) throws IOExceptionDescription copied from interface:JsonSerializableSerialization method called when no additional type information is to be included in serialization.- Specified by:
serializein interfaceJsonSerializable- Throws:
IOException
-
serializeWithType
public void serializeWithType(com.fasterxml.jackson.core.JsonGenerator gen, SerializerProvider serializers, TypeSerializer typeSer) throws IOExceptionDescription copied from interface:JsonSerializableSerialization 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(com.fasterxml.jackson.core.JsonGenerator, com.fasterxml.jackson.core.type.WritableTypeId)followed by serialization of contents, followed by a call toTypeSerializer.writeTypeSuffix(com.fasterxml.jackson.core.JsonGenerator, com.fasterxml.jackson.core.type.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:
serializeWithTypein interfaceJsonSerializable- Throws:
IOException
-
serialize
public void serialize(com.fasterxml.jackson.core.JsonGenerator gen) throws IOException- Throws:
IOException
-
_serialize
protected void _serialize(com.fasterxml.jackson.core.JsonGenerator gen) throws IOException- Throws:
IOException
-
-