Package org.opennms.netmgt.flows.elastic
Class GPath<O>
- java.lang.Object
-
- org.opennms.netmgt.flows.elastic.GPath<O>
-
- Type Parameters:
O- the selection result
public class GPath<O> extends Object
Allows to select values from GSON documents Theevalmethod returns the selection result given a root JsonElement. GPath instances can be built either- by starting from the last select step and adding the preceding selection steps
in a fluent interface like manner (e.g. the GPath
string().field("name")accesses the "name" field of a GSON document) or - by using nested methods calls (e.g. the nested method calls
field("name", string())construct the same GSON path).
-
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description static GPath<com.google.gson.JsonElement>any()static GPath<com.google.gson.JsonArray>array()GPath<List<O>>array(String name)static <X> GPath<List<X>>array(String name, GPath<X> path)static GPath<Double>dbl()Oeval(com.google.gson.JsonElement in)Returns the selection result given the root JsonElement.GPath<O>field(String name)GPath<O>field(String name, String altName)static <X> GPath<X>field(String name, String altName, GPath<X> path)static <X> GPath<X>field(String name, GPath<X> path)static GPath<Integer>integer()<X> GPath<X>map(java.util.function.Function<O,X> f)static GPath<com.google.gson.JsonObject>object()static GPath<String>string()
-
-
-
Constructor Detail
-
GPath
public GPath(java.util.function.Function<com.google.gson.JsonElement,O> eval)
-
-
Method Detail
-
any
public static GPath<com.google.gson.JsonElement> any()
-
object
public static GPath<com.google.gson.JsonObject> object()
-
array
public static GPath<com.google.gson.JsonArray> array()
-
eval
public O eval(com.google.gson.JsonElement in)
Returns the selection result given the root JsonElement.- Parameters:
in- the root element the evaluation is base on.- Returns:
- in case that the GPath selects non-existing fields
nullis returned.
-
-