public final class LiteralExpression extends JmespathExpression
Modifier and Type | Field and Description |
---|---|
static LiteralExpression |
ANY
Sentinel value to represent ANY.
|
static LiteralExpression |
ARRAY
Sentinel value to represent any ARRAY.
|
static LiteralExpression |
BOOLEAN
Sentinel value to represent any BOOLEAN.
|
static LiteralExpression |
EXPREF
Sentinel value to represent an expression reference.
|
static LiteralExpression |
NULL
Sentinel value to represent null.
|
static LiteralExpression |
NUMBER
Sentinel value to represent any NULL.
|
static LiteralExpression |
OBJECT
Sentinel value to represent any OBJECT.
|
static LiteralExpression |
STRING
Sentinel value to represent any STRING.
|
Constructor and Description |
---|
LiteralExpression(java.lang.Object value) |
LiteralExpression(java.lang.Object value,
int line,
int column) |
Modifier and Type | Method and Description |
---|---|
<T> T |
accept(ExpressionVisitor<T> visitor)
Visits a node using a double-dispatch visitor.
|
boolean |
equals(java.lang.Object o) |
java.util.List<java.lang.Object> |
expectArrayValue()
Gets the value as an array.
|
boolean |
expectBooleanValue()
Gets the value as a boolean.
|
java.lang.Number |
expectNumberValue()
Gets the value as a number.
|
java.util.Map<java.lang.String,java.lang.Object> |
expectObjectValue()
Gets the value as an object.
|
java.lang.String |
expectStringValue()
Gets the value as a string.
|
static LiteralExpression |
from(java.lang.Object value)
Creates a LiteralExpression from
value , unwrapping it if necessary. |
LiteralExpression |
getArrayIndex(int index)
Expects the value to be an array and gets the value at the given
index.
|
LiteralExpression |
getObjectField(java.lang.String name)
Expects the value to be an object and gets a field by
name.
|
RuntimeType |
getType()
Gets the type of the value.
|
java.lang.Object |
getValue()
Gets the nullable value contained in the literal value.
|
int |
hashCode() |
boolean |
hasObjectField(java.lang.String name)
Expects the value to be an object and checks if it contains
a field by name.
|
boolean |
isArrayValue()
Checks if the value is an array.
|
boolean |
isBooleanValue()
Checks if the value is a boolean.
|
boolean |
isNullValue()
Checks if the value is null.
|
boolean |
isNumberValue()
Checks if the value is a number.
|
boolean |
isObjectValue()
Checks if the value is an object.
|
boolean |
isStringValue()
Checks if the value is a string.
|
boolean |
isTruthy()
Returns true if the value is truthy according to JMESPath.
|
java.lang.String |
toString() |
public static final LiteralExpression ANY
public static final LiteralExpression ARRAY
public static final LiteralExpression OBJECT
public static final LiteralExpression BOOLEAN
public static final LiteralExpression STRING
public static final LiteralExpression NUMBER
public static final LiteralExpression EXPREF
public static final LiteralExpression NULL
public LiteralExpression(java.lang.Object value)
public LiteralExpression(java.lang.Object value, int line, int column)
public static LiteralExpression from(java.lang.Object value)
value
, unwrapping it if necessary.value
- Value to create the expression from.value
.public <T> T accept(ExpressionVisitor<T> visitor)
JmespathExpression
accept
in class JmespathExpression
T
- Type of value the visitor returns.visitor
- Visitor to accept on the node.public java.lang.Object getValue()
public boolean equals(java.lang.Object o)
equals
in class java.lang.Object
public int hashCode()
hashCode
in class java.lang.Object
public java.lang.String toString()
toString
in class java.lang.Object
public RuntimeType getType()
public LiteralExpression getObjectField(java.lang.String name)
LiteralExpression
with a null value is returned.name
- Field to get from the expected object.public boolean hasObjectField(java.lang.String name)
name
- Field to get from the expected object.public LiteralExpression getArrayIndex(int index)
LiteralExpression
with a null value is returned.index
- Index to get from the array.public boolean isStringValue()
public boolean isNumberValue()
public boolean isBooleanValue()
public boolean isArrayValue()
public boolean isObjectValue()
public boolean isNullValue()
public java.lang.String expectStringValue()
JmespathException
- if the value is not a string.public java.lang.Number expectNumberValue()
JmespathException
- if the value is not a number.public boolean expectBooleanValue()
JmespathException
- if the value is not a boolean.public java.util.List<java.lang.Object> expectArrayValue()
JmespathException
- if the value is not an array.public java.util.Map<java.lang.String,java.lang.Object> expectObjectValue()
JmespathException
- if the value is not an object.public boolean isTruthy()