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 java.lang.Object
Allows to select values from GSON documents Theeval
method 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<java.util.List<O>>
array(java.lang.String name)
static <X> GPath<java.util.List<X>>
array(java.lang.String name, GPath<X> path)
static GPath<java.lang.Double>
dbl()
O
eval(com.google.gson.JsonElement in)
Returns the selection result given the root JsonElement.GPath<O>
field(java.lang.String name)
GPath<O>
field(java.lang.String name, java.lang.String altName)
static <X> GPath<X>
field(java.lang.String name, java.lang.String altName, GPath<X> path)
static <X> GPath<X>
field(java.lang.String name, GPath<X> path)
static GPath<java.lang.Integer>
integer()
<X> GPath<X>
map(java.util.function.Function<O,X> f)
static GPath<com.google.gson.JsonObject>
object()
static GPath<java.lang.String>
string()
-
-
-
Constructor Detail
-
GPath
public GPath(java.util.function.Function<com.google.gson.JsonElement,O> eval)
-
-
Method Detail
-
string
public static GPath<java.lang.String> string()
-
dbl
public static GPath<java.lang.Double> dbl()
-
integer
public static GPath<java.lang.Integer> integer()
-
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()
-
field
public static <X> GPath<X> field(java.lang.String name, java.lang.String altName, GPath<X> path)
-
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
null
is returned.
-
-