public class JsonFunctions
extends java.lang.Object
Modifier and Type | Method and Description |
---|---|
static <any> |
asJson() |
static <T> <any> |
cast(java.lang.Class<T> expected) |
static <T> <any> |
castM(java.lang.Class<T> expected) |
static <T> <any> |
castM(java.lang.Class<T> expected,
T defaultValue) |
static <T> <any> |
forEach(<any> func) |
static <T> <any> |
getPath(java.lang.String path)
returns an element from a single json primitive value given a full path
JsonPath |
static <any> |
walk(java.lang.Iterable<java.lang.String> elements)
returns a function which traverses the supplied path of entries in a json object (maps of maps of maps...),
|
static <any> |
walk(java.lang.String... elements)
as
walkM(Iterable) taking a series of strings (dot separators not respected here) |
static <any> |
walk(java.lang.String elementOrDotSeparatedElements)
as
walkM(Iterable) taking a single string consisting of a dot separated path |
static <any> |
walkM(java.lang.Iterable<java.lang.String> elements)
as
#walk(Iterable)) but working with objects which Maybe contain JsonElement ,
simply preserving a Maybe.absent() object if additional walks are requested upon it
(cf jquery) |
static <any> |
walkM(java.lang.String... elements)
as
#walk(String...)) and walk(Iterable) |
static <any> |
walkM(java.lang.String elements)
as
#walk(String)) and walk(Iterable) |
static <any> |
walkN(java.lang.Iterable<java.lang.String> elements)
as
#walk(Iterable)) but if any element is not found it simply returns null |
static <any> |
walkN(java.lang.String... elements)
as
#walk(String...)) but if any element is not found it simply returns null |
static <any> |
walkN(java.lang.String elements)
as
walk(String) but if any element is not found it simply returns null |
public static <any> asJson()
public static <T> <any> forEach(<any> func)
public static <any> walk(java.lang.String elementOrDotSeparatedElements)
walkM(Iterable)
taking a single string consisting of a dot separated pathpublic static <any> walk(java.lang.String... elements)
walkM(Iterable)
taking a series of strings (dot separators not respected here)public static <any> walk(java.lang.Iterable<java.lang.String> elements)
java.util.NoSuchElementException
- if any path is not present as a key in that mappublic static <any> walkN(@Nullable java.lang.String elements)
walk(String)
but if any element is not found it simply returns nullpublic static <any> walkN(java.lang.String... elements)
#walk(String...))
but if any element is not found it simply returns nullpublic static <any> walkN(java.lang.Iterable<java.lang.String> elements)
#walk(Iterable))
but if any element is not found it simply returns nullpublic static <any> walkM(@Nullable java.lang.String elements)
#walk(String))
and walk(Iterable)
public static <any> walkM(java.lang.String... elements)
#walk(String...))
and walk(Iterable)
public static <any> walkM(java.lang.Iterable<java.lang.String> elements)
#walk(Iterable))
but working with objects which Maybe
contain JsonElement
,
simply preserving a Maybe.absent()
object if additional walks are requested upon it
(cf jquery)public static <T> <any> getPath(java.lang.String path)
JsonPath
public static <T> <any> cast(java.lang.Class<T> expected)
public static <T> <any> castM(java.lang.Class<T> expected)
public static <T> <any> castM(java.lang.Class<T> expected, T defaultValue)