Package ai.vespa.json
Class Json
java.lang.Object
ai.vespa.json.Json
A
Slime wrapper that throws InvalidJsonException on missing members or invalid types.- Author:
- bjorncs
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionstatic classProvides a fluent API for building aSlimeinstance.static class -
Method Summary
Modifier and TypeMethodDescriptiona(int index) booleanasBool()booleanasBool(boolean defaultValue) doubleasDouble()doubleasDouble(double defaultValue) longasLong()longasLong(long defaultValue) asString()entry(int index) voidforEachEntry(BiConsumer<Integer, Json> consumer) voidforEachEntry(Consumer<Json> consumer) voidforEachField(BiConsumer<String, Json> consumer) booleanbooleanisArray()booleanisBool()booleanisDouble()booleanbooleanbooleanisLong()booleanbooleanisNumber()booleanisObject()booleanbooleanisString()iterator()intlength()static Jsonstatic Jsonstatic Jsonstream()toJson(boolean pretty) toList()toString()Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, waitMethods inherited from interface java.lang.Iterable
forEach, spliterator
-
Method Details
-
of
-
of
-
of
-
f
-
field
-
a
-
entry
-
length
public int length() -
has
-
isPresent
public boolean isPresent() -
isMissing
public boolean isMissing() -
isExplicitNull
public boolean isExplicitNull()- Returns:
- true if the JSON field was present but its value was 'null'
-
asOptionalString
-
asString
-
asString
-
asOptionalLong
-
asLong
public long asLong() -
asLong
public long asLong(long defaultValue) -
asOptionalDouble
-
asDouble
public double asDouble() -
asDouble
public double asDouble(double defaultValue) -
asOptionalBool
-
asBool
public boolean asBool() -
asBool
public boolean asBool(boolean defaultValue) -
asOptionalInstant
-
asInstant
-
asInstant
-
toList
-
stream
-
toJson
-
isString
public boolean isString() -
isArray
public boolean isArray() -
isLong
public boolean isLong() -
isDouble
public boolean isDouble() -
isBool
public boolean isBool() -
isNumber
public boolean isNumber() -
isObject
public boolean isObject() -
isEqualTo
-
iterator
-
forEachField
-
forEachEntry
-
forEachEntry
-
toString
-