Package co.elastic.clients.json
Class BuildFunctionDeserializer<B,T>
java.lang.Object
co.elastic.clients.json.DelegatingDeserializer<T,B>
co.elastic.clients.json.BuildFunctionDeserializer<B,T>
- All Implemented Interfaces:
JsonpDeserializer<T>
public class BuildFunctionDeserializer<B,T> extends DelegatingDeserializer<T,B>
An object deserializer based on a builder object deserializer and a build function.
Used in tagged unions that have union-level properties (aka "container properties").
-
Nested Class Summary
Nested classes/interfaces inherited from class co.elastic.clients.json.DelegatingDeserializer
DelegatingDeserializer.SameType<T>
-
Constructor Summary
Constructors Constructor Description BuildFunctionDeserializer(JsonpDeserializer<B> builderDeserializer, java.util.function.Function<B,T> build)
-
Method Summary
Modifier and Type Method Description T
deserialize(jakarta.json.stream.JsonParser parser, JsonpMapper mapper)
Deserialize a value.T
deserialize(jakarta.json.stream.JsonParser parser, JsonpMapper mapper, jakarta.json.stream.JsonParser.Event event)
Deserialize a value.protected JsonpDeserializer<B>
unwrap()
Methods inherited from class co.elastic.clients.json.DelegatingDeserializer
acceptedEvents, nativeEvents, unwrap
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
Methods inherited from interface co.elastic.clients.json.JsonpDeserializer
accepts
-
Constructor Details
-
BuildFunctionDeserializer
public BuildFunctionDeserializer(JsonpDeserializer<B> builderDeserializer, java.util.function.Function<B,T> build)
-
-
Method Details
-
unwrap
- Specified by:
unwrap
in classDelegatingDeserializer<T,B>
-
deserialize
Description copied from interface:JsonpDeserializer
Deserialize a value. The value starts at the next state in the JSON stream.Default implementation delegates to
JsonpDeserializer.deserialize(JsonParser, JsonpMapper, Event)
after having checked that the next event is part of the accepted events.If the next event is
JsonParser.Event.VALUE_NULL
,null
is returned unlessJsonParser.Event.VALUE_NULL
is part of the deserializer's accepted events.- Parameters:
parser
- the JSON parsermapper
- the JSON-P mapper- Returns:
- the parsed value or null
-
deserialize
public T deserialize(jakarta.json.stream.JsonParser parser, JsonpMapper mapper, jakarta.json.stream.JsonParser.Event event)Description copied from interface:JsonpDeserializer
Deserialize a value. The value starts at the current state in the JSON stream.- Parameters:
parser
- the JSON parsermapper
- the JSON-P mapperevent
- the current state ofparser
, which must be part ofJsonpDeserializer.acceptedEvents()
- Returns:
- the parsed value
-