public abstract class BaseRuntime<T> extends Object implements Adapter<T>
Adapter directly,
in order to not have to implement a few of the methods that have non-specific
implementations, like Adapter.functionRegistry(), Adapter.typeOf(T)
or the Comparable interface. Subclasses are encouraged to override
these methods if they have more efficient means to perform the same job.| Constructor and Description |
|---|
BaseRuntime()
Create a new runtime with a default function registry.
|
BaseRuntime(RuntimeConfiguration configuration)
Create a new runtime with configuration.
|
| Modifier and Type | Method and Description |
|---|---|
int |
compare(T value1,
T value2)
Basic implementation of
Comparator.compare(T, T). |
Expression<T> |
compile(String expression)
Compile a JMESPath expression into a reusable expression object.
|
boolean |
equals(Object o)
Required method from the
Comparator interface, returns
true when the argument is of the same class, or a subclass of, the receiver. |
FunctionRegistry |
functionRegistry()
Returns a function registry that can be used by the expression compiler
to look up functions.
|
T |
getProperty(T value,
String name)
Deprecated.
|
T |
handleArgumentTypeError(Function function,
String expectedType,
String actualType)
Throws
ArgumentTypeException unless RuntimeConfiguration.silentTypeErrors
is true, in which case it returns a null value (not Java null). |
int |
hashCode() |
NodeFactory<T> |
nodeFactory()
Returns a node factory that can be used by the expression compiler to build
the interpreter AST.
|
clone, finalize, getClass, notify, notifyAll, toString, wait, wait, waitcreateArray, createBoolean, createNull, createNumber, createNumber, createObject, createString, getProperty, getPropertyNames, isTruthy, parseString, toList, toNumber, toString, typeOfcomparing, comparing, comparingDouble, comparingInt, comparingLong, naturalOrder, nullsFirst, nullsLast, reversed, reverseOrder, thenComparing, thenComparing, thenComparing, thenComparingDouble, thenComparingInt, thenComparingLongpublic BaseRuntime()
public BaseRuntime(RuntimeConfiguration configuration)
public Expression<T> compile(String expression)
JmesPathThe expression objects should be stateless and thread safe, but the exact details are up to the concrete implementations.
public int compare(T value1, T value2)
Comparator.compare(T, T).
Subclasses should override this method if they have a more efficient way to
compare booleans, numbers and strings than to convert them to Java types
using Adapter.isTruthy(T), Adapter.toNumber(T),
Adapter.toString(T), etc.
This only implements Comparator.compare(T, T) fully for
null, number and string, for
boolean array and object it only
does equality – specifically this means that it will return 0 for equal
booleans, objects or arrays, and -1 otherwise. The reason is that JMESPath
doesn't have any mechanisms for comparing objects or arrays, and doesn't
define how objects and arrays should be compared.
When the arguments are not of the same type -1 is returned.
compare in interface Comparator<T>public T handleArgumentTypeError(Function function, String expectedType, String actualType)
ArgumentTypeException unless RuntimeConfiguration.silentTypeErrors
is true, in which case it returns a null value (not Java null).handleArgumentTypeError in interface Adapter<T>public FunctionRegistry functionRegistry()
AdapterfunctionRegistry in interface Adapter<T>public NodeFactory<T> nodeFactory()
AdapternodeFactory in interface Adapter<T>public boolean equals(Object o)
Comparator interface, returns
true when the argument is of the same class, or a subclass of, the receiver.equals in interface Comparator<T>equals in class Object@Deprecated public T getProperty(T value, String name)
Adapternull) is returned.getProperty in interface Adapter<T>Copyright © 2016–2023. All rights reserved.