Package org.opensearch.client.json
Interface LookAheadJsonParser
-
- All Superinterfaces:
java.lang.AutoCloseable,java.io.Closeable,jakarta.json.stream.JsonParser
- All Known Implementing Classes:
JacksonJsonpParser
public interface LookAheadJsonParser extends jakarta.json.stream.JsonParser
-
-
Method Summary
All Methods Instance Methods Abstract Methods Modifier and Type Method Description <Variant> java.util.Map.Entry<Variant,jakarta.json.stream.JsonParser>findVariant(java.util.Map<java.lang.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.java.util.Map.Entry<java.lang.String,jakarta.json.stream.JsonParser>lookAheadFieldValue(java.lang.String name, java.lang.String defaultValue)Look ahead the value of a text property in the JSON stream.
-
-
-
Method Detail
-
lookAheadFieldValue
java.util.Map.Entry<java.lang.String,jakarta.json.stream.JsonParser> lookAheadFieldValue(java.lang.String name, java.lang.String defaultValue)Look ahead the value of a text property in the JSON stream. The parser must be on theSTART_OBJECTevent.- 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
nullif not found), and a parser to be used to read the JSON object.
-
findVariant
<Variant> java.util.Map.Entry<Variant,jakarta.json.stream.JsonParser> findVariant(java.util.Map<java.lang.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
nullif not found), and a parser to be used to read the JSON object.
-
-