Package co.elastic.clients.json
Interface JsonData
- All Superinterfaces:
JsonpSerializable
A raw JSON value. It can be converted to a JSON node tree or to an arbitrary object using a
JsonpMapper
.
This type is used in API types for values that don't have a statically-defined type or that cannot be represented as a generic parameter of the enclosing data structure.
Instances of this class returned by API clients keep a reference to the client's JsonpMapper
and can be
converted to arbitrary types using to(Class)
without requiring an explicit mapper.
-
Field Summary
-
Method Summary
Modifier and TypeMethodDescription<T> T
deserialize
(JsonpDeserializer<T> deserializer) Converts this object using a deserializer.<T> T
deserialize
(JsonpDeserializer<T> deserializer, JsonpMapper mapper) Converts this object using a deserializer.static JsonData
from
(jakarta.json.stream.JsonParser parser, JsonpMapper mapper) Creates a raw JSON value from a parser.static JsonData
from
(jakarta.json.stream.JsonParser parser, JsonpMapper mapper, jakarta.json.stream.JsonParser.Event event) Creates a raw JSON value from a parser.static JsonData
from
(InputStream json) Creates a raw JSON value from an input stream.static JsonData
Creates a raw JSON value from a reader.static JsonData
Creates a raw JSON value from a reader.static <T> JsonData
of
(T value) Creates a raw JSON value from an existing object.static <T> JsonData
of
(T value, JsonpMapper mapper) Creates a raw JSON value from an existing object, along with the mapper to use for further conversions.default <T> T
Converts this object to a target class.default <T> T
to
(Class<T> clazz, JsonpMapper mapper) Converts this object to a target class.<T> T
Converts this object to a target type.<T> T
to
(Type type, JsonpMapper mapper) Converts this object to a target type.jakarta.json.JsonValue
toJson()
Converts this object to a JSON node tree.jakarta.json.JsonValue
toJson
(JsonpMapper mapper) Converts this object to a JSON node tree.Methods inherited from interface co.elastic.clients.json.JsonpSerializable
serialize
-
Field Details
-
_DESERIALIZER
-
-
Method Details
-
toJson
jakarta.json.JsonValue toJson()Converts this object to a JSON node tree. A mapper must have been provided at creation time.- Throws:
IllegalStateException
- if no mapper was provided at creation time.
-
toJson
Converts this object to a JSON node tree. -
to
Converts this object to a target class. A mapper must have been provided at creation time.- Throws:
IllegalStateException
- if no mapper was provided at creation time.
-
to
Converts this object to a target type. A mapper must have been provided at creation time.- Throws:
IllegalStateException
- if no mapper was provided at creation time.
-
to
Converts this object to a target class. -
to
Converts this object to a target type. -
deserialize
Converts this object using a deserializer. A mapper must have been provided at creation time.- Throws:
IllegalStateException
- if no mapper was provided at creation time.
-
deserialize
Converts this object using a deserializer. -
of
Creates a raw JSON value from an existing object. A mapper will be needed to convert the result. -
of
Creates a raw JSON value from an existing object, along with the mapper to use for further conversions. -
fromJson
Creates a raw JSON value from a reader.Note: this method is not called
from
likefrom(Reader)
orfrom(InputStream)
to avoid ambiguities withof(Object)
that will create a JSON string value instead of parsing the JSON text. -
from
Creates a raw JSON value from a reader. -
from
Creates a raw JSON value from an input stream. -
from
Creates a raw JSON value from a parser. The provider mapper will be used for conversions unless one is explicitly provided usingto(Class, JsonpMapper)
,toJson(JsonpMapper)
ordeserialize(JsonpDeserializer)
. -
from
static JsonData from(jakarta.json.stream.JsonParser parser, JsonpMapper mapper, jakarta.json.stream.JsonParser.Event event) Creates a raw JSON value from a parser. The provider mapper will be used for conversions unless one is explicitly provided usingto(Class, JsonpMapper)
,toJson(JsonpMapper)
ordeserialize(JsonpDeserializer)
.
-