Package co.elastic.clients.json
Class NamedDeserializer<T>
java.lang.Object
co.elastic.clients.json.NamedDeserializer<T>
- All Implemented Interfaces:
JsonpDeserializer<T>
A deserializer that delegates to another deserializer provided as a JSON mapper attribute.
-
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptionEnumSet<jakarta.json.stream.JsonParser.Event>
The JSON events this deserializer accepts as a starting point.deserialize
(jakarta.json.stream.JsonParser parser, JsonpMapper mapper) Deserialize a value.deserialize
(jakarta.json.stream.JsonParser parser, JsonpMapper mapper, jakarta.json.stream.JsonParser.Event event) Deserialize a value.EnumSet<jakarta.json.stream.JsonParser.Event>
The native JSON events this deserializer accepts as a starting point.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
-
NamedDeserializer
-
-
Method Details
-
nativeEvents
Description copied from interface:JsonpDeserializer
The native JSON events this deserializer accepts as a starting point. For example, native events for a boolean areJsonParser.Event.VALUE_TRUE
andJsonParser.Event.VALUE_FALSE
.- Specified by:
nativeEvents
in interfaceJsonpDeserializer<T>
-
acceptedEvents
Description copied from interface:JsonpDeserializer
The JSON events this deserializer accepts as a starting point. For example, events for a boolean areJsonParser.Event.VALUE_TRUE
,JsonParser.Event.VALUE_FALSE
andJsonParser.Event.VALUE_STRING
, the latter being converted to a boolean usingBoolean.parseBoolean(String)
.- Specified by:
acceptedEvents
in interfaceJsonpDeserializer<T>
-
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.- Specified by:
deserialize
in interfaceJsonpDeserializer<T>
- 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.- Specified by:
deserialize
in interfaceJsonpDeserializer<T>
- Parameters:
parser
- the JSON parsermapper
- the JSON-P mapperevent
- the current state ofparser
, which must be part ofJsonpDeserializer.acceptedEvents()
- Returns:
- the parsed value
-