Package co.elastic.clients.json
Interface LookAheadJsonParser
- All Superinterfaces:
AutoCloseable
,Closeable
,jakarta.json.stream.JsonParser
- All Known Implementing Classes:
JacksonJsonpParser
public interface LookAheadJsonParser
extends jakarta.json.stream.JsonParser
-
Nested Class Summary
Nested classes/interfaces inherited from interface jakarta.json.stream.JsonParser
jakarta.json.stream.JsonParser.Event
-
Method Summary
Modifier and TypeMethodDescription<Variant> Map.Entry<Variant,
jakarta.json.stream.JsonParser> findVariant
(Map<String, Variant> variants) In union types, find the variant to be used by looking up property names in the JSON stream until we find one that uniquely identifies the variant.lookAheadFieldValue
(String name, String defaultValue) Look ahead the value of a text property in the JSON stream.Methods inherited from interface jakarta.json.stream.JsonParser
close, getArray, getArrayStream, getBigDecimal, getInt, getLocation, getLong, getObject, getObjectStream, getString, getValue, getValueStream, hasNext, isIntegralNumber, next, skipArray, skipObject
-
Method Details
-
lookAheadFieldValue
Map.Entry<String,jakarta.json.stream.JsonParser> lookAheadFieldValue(String name, String defaultValue) Look ahead the value of a text property in the JSON stream. The parser must be on theSTART_OBJECT
event.- Parameters:
name
- the field name to look up.defaultValue
- default value if the field is not found.- Returns:
- a pair containing the field value (or
null
if not found), and a parser to be used to read the JSON object.
-
findVariant
<Variant> Map.Entry<Variant,jakarta.json.stream.JsonParser> findVariant(Map<String, Variant> variants) In union types, find the variant to be used by looking up property names in the JSON stream until we find one that uniquely identifies the variant.- Type Parameters:
Variant
- the type of variant descriptors used by the caller.- Parameters:
variants
- a map of variant descriptors, keyed by the property name that uniquely identifies the variant.- Returns:
- a pair containing the variant descriptor (or
null
if not found), and a parser to be used to read the JSON object.
-