Class NodeJmespathRuntime
java.lang.Object
software.amazon.smithy.model.jmespath.node.NodeJmespathRuntime
- All Implemented Interfaces:
Comparator<Node>,JmespathRuntime<Node>
A singleton implementation of the JmespathRuntime interface based on instances of the Node class.
-
Nested Class Summary
Nested classes/interfaces inherited from interface software.amazon.smithy.jmespath.evaluation.JmespathRuntime
JmespathRuntime.ArrayBuilder<T>, JmespathRuntime.ObjectBuilder<T> -
Field Summary
FieldsModifier and TypeFieldDescriptionstatic final NodeJmespathRuntimeSingleton instance of the runtime. -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionCreates a new ArrayBuilder.booleanIf the given value is a BOOLEAN, return it as a boolean.asIterable(Node value) Iterate over the elements of an ARRAY or the keys of an OBJECT.If the given value is a NUMBER, return it as a Number.If the given value is a STRING, return it as a String.createBoolean(boolean b) Creates a BOOLEAN value.Returns `null`.createNumber(Number value) Creates a NUMBER value.createString(String string) Creates a STRING value.If the given value is an ARRAY, returns the element at the given index.intReturns the number of elements in an ARRAY or the number of keys in an OBJECT.numberType(Node value) Returns the type of Number that asNumber() will produce for this value.Creates a new ObjectBuilder.Returns the basic type of the given value: NULL, BOOLEAN, STRING, NUMBER, OBJECT, or ARRAY.If the given value is an OBJECT, returns the value mapped to the given key.Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitMethods inherited from interface java.util.Comparator
equals, reversed, thenComparing, thenComparing, thenComparing, thenComparingDouble, thenComparingInt, thenComparingLong
-
Field Details
-
INSTANCE
Singleton instance of the runtime.
-
-
Constructor Details
-
NodeJmespathRuntime
public NodeJmespathRuntime()
-
-
Method Details
-
typeOf
Description copied from interface:JmespathRuntimeReturns the basic type of the given value: NULL, BOOLEAN, STRING, NUMBER, OBJECT, or ARRAY.MUST NOT ever return EXPRESSION or ANY.
- Specified by:
typeOfin interfaceJmespathRuntime<Node>
-
createNull
Description copied from interface:JmespathRuntimeReturns `null`.Runtimes may or may not use a Java null value to represent a JSON null value.
- Specified by:
createNullin interfaceJmespathRuntime<Node>
-
createBoolean
Description copied from interface:JmespathRuntimeCreates a BOOLEAN value.- Specified by:
createBooleanin interfaceJmespathRuntime<Node>
-
asBoolean
Description copied from interface:JmespathRuntimeIf the given value is a BOOLEAN, return it as a boolean. Otherwise, throws a JmespathException of type INVALID_TYPE.- Specified by:
asBooleanin interfaceJmespathRuntime<Node>
-
createString
Description copied from interface:JmespathRuntimeCreates a STRING value.- Specified by:
createStringin interfaceJmespathRuntime<Node>
-
asString
Description copied from interface:JmespathRuntimeIf the given value is a STRING, return it as a String. Otherwise, throws a JmespathException of type INVALID_TYPE.Note the distinction between this method and toString(), which can be called on any value and produces a JSON string.
- Specified by:
asStringin interfaceJmespathRuntime<Node>
-
createNumber
Description copied from interface:JmespathRuntimeCreates a NUMBER value.- Specified by:
createNumberin interfaceJmespathRuntime<Node>
-
numberType
Description copied from interface:JmespathRuntimeReturns the type of Number that asNumber() will produce for this value. Will be more efficient for some runtimes than checking the class of asNumber().- Specified by:
numberTypein interfaceJmespathRuntime<Node>
-
asNumber
Description copied from interface:JmespathRuntimeIf the given value is a NUMBER, return it as a Number. Otherwise, throws a JmespathException of type INVALID_TYPE.- Specified by:
asNumberin interfaceJmespathRuntime<Node>
-
length
Description copied from interface:JmespathRuntimeReturns the number of elements in an ARRAY or the number of keys in an OBJECT. Otherwise, throws a JmespathException of type INVALID_TYPE.- Specified by:
lengthin interfaceJmespathRuntime<Node>
-
element
Description copied from interface:JmespathRuntimeIf the given value is an ARRAY, returns the element at the given index. Otherwise, throws a JmespathException of type INVALID_TYPE.- Specified by:
elementin interfaceJmespathRuntime<Node>
-
asIterable
Description copied from interface:JmespathRuntimeIterate over the elements of an ARRAY or the keys of an OBJECT. Otherwise, throws a JmespathException of type INVALID_TYPE.- Specified by:
asIterablein interfaceJmespathRuntime<Node>
-
arrayBuilder
Description copied from interface:JmespathRuntimeCreates a new ArrayBuilder.- Specified by:
arrayBuilderin interfaceJmespathRuntime<Node>
-
value
Description copied from interface:JmespathRuntimeIf the given value is an OBJECT, returns the value mapped to the given key. Otherwise, returns NULL.- Specified by:
valuein interfaceJmespathRuntime<Node>
-
objectBuilder
Description copied from interface:JmespathRuntimeCreates a new ObjectBuilder.- Specified by:
objectBuilderin interfaceJmespathRuntime<Node>
-