Package software.amazon.smithy.jmespath
Class JmespathExpression
java.lang.Object
software.amazon.smithy.jmespath.JmespathExpression
- Direct Known Subclasses:
BinaryExpression,CurrentExpression,ExpressionTypeExpression,FieldExpression,FlattenExpression,FunctionExpression,IndexExpression,LiteralExpression,MultiSelectHashExpression,MultiSelectListExpression,NotExpression,SliceExpression
Represents a JMESPath AST node.
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionabstract <T> Taccept(ExpressionVisitor<T> visitor) Visits a node using a double-dispatch visitor.evaluate(LiteralExpression currentNode) Evaluate the expression for the given current node.<T> Tevaluate(T currentNode, JmespathRuntime<T> runtime) Evaluate the expression for the given current node.final intGet the approximate column where the node was defined.final intgetLine()Get the approximate line where the node was defined.lint()Lint the expression using static analysis using "any" as the current node.lint(LiteralExpression currentNode) Lint the expression using static analysis.static JmespathExpressionParse a JMESPath expression.static <T> JmespathExpressionparse(String text, JmespathRuntime<T> runtime) Parse a JMESPath expression.static <T> TparseJson(String text, JmespathRuntime<T> runtime) Parse a JSON value.
-
Constructor Details
-
JmespathExpression
protected JmespathExpression(int line, int column)
-
-
Method Details
-
parse
Parse a JMESPath expression.- Parameters:
text- Expression to parse.- Returns:
- Returns the parsed expression.
- Throws:
JmespathException- if the expression is invalid.
-
parse
Parse a JMESPath expression.- Parameters:
text- Expression to parse.runtime- The JmespathRuntime used to instantiate literal values.- Returns:
- Returns the parsed expression.
- Throws:
JmespathException- if the expression is invalid.
-
parseJson
Parse a JSON value.- Parameters:
text- JSON value to parse.runtime- The JmespathRuntime used to instantiate the parsed JSON value.- Returns:
- Returns the parsed JSON value.
- Throws:
JmespathException- if the text is invalid.
-
getLine
public final int getLine()Get the approximate line where the node was defined.- Returns:
- Returns the line.
-
getColumn
public final int getColumn()Get the approximate column where the node was defined.- Returns:
- Returns the column.
-
accept
Visits a node using a double-dispatch visitor.- Type Parameters:
T- Type of value the visitor returns.- Parameters:
visitor- Visitor to accept on the node.- Returns:
- Returns the result of applying the visitor.
-
lint
Lint the expression using static analysis using "any" as the current node.- Returns:
- Returns the linter result.
-
lint
Lint the expression using static analysis.- Parameters:
currentNode- The value to set as the current node.- Returns:
- Returns the problems that were detected.
-
evaluate
Evaluate the expression for the given current node.- Parameters:
currentNode- The value to set as the current node.- Returns:
- Returns the result of evaluating the expression.
-
evaluate
Evaluate the expression for the given current node.- Parameters:
currentNode- The value to set as the current node.runtime- The JmespathRuntime used to manipulate node values.- Returns:
- Returns the result of evaluating the expression.
-