CtrlK
BlogDocsLog inGet started
Tessl Logo

tessl/maven-com-amazonaws--jmespath-java

Implementation of the JMES Path JSON Query language for Java

Pending
Overview
Eval results
Files

expression-evaluation.mddocs/

Expression Evaluation

The primary visitor implementation that evaluates JMESPath expressions against JSON data. This is the main execution engine that processes expression trees and returns JSON results.

Capabilities

Evaluation Visitor

The concrete visitor implementation that evaluates all expression types against JsonNode input data.

public class JmesPathEvaluationVisitor implements JmesPathVisitor<JsonNode, JsonNode> {
    /**
     * Creates a new evaluation visitor for processing expressions
     */
    public JmesPathEvaluationVisitor();
}

Field Access Evaluation

Retrieves field values from JSON objects with camelCase conversion support.

public JsonNode visit(JmesPathField fieldNode, JsonNode input) {
    /**
     * Evaluates field access on the input JSON node
     * @param fieldNode The field expression to evaluate
     * @param input The JSON object to access
     * @return The field value or null if not found/invalid type
     */
}

Implementation Details:

  • Returns the field value if input is a JSON object
  • Applies camelCase conversion to field names
  • Returns NullNode if input is not an object or field not found

Identity Evaluation

Returns the input node unchanged.

public JsonNode visit(JmesPathIdentity jmesPathIdentity, JsonNode input) {
    /**
     * Returns the input node as-is
     * @param jmesPathIdentity The identity expression
     * @param input The input JSON node
     * @return The input node unchanged
     */
}

Literal Evaluation

Returns the literal value stored in the expression.

public JsonNode visit(JmesPathLiteral literal, JsonNode input) {
    /**
     * Returns the literal value
     * @param literal The literal expression containing the value
     * @param input The input JSON node (ignored)
     * @return The literal value as JsonNode
     */
}

Sub-Expression Evaluation

Evaluates chained expressions in sequence, passing results between expressions.

public JsonNode visit(JmesPathSubExpression subExpression, JsonNode input) throws InvalidTypeException {
    /**
     * Evaluates a chain of expressions sequentially
     * @param subExpression The sub-expression containing chained expressions
     * @param input The initial input JSON node
     * @return The result of the final expression in the chain
     * @throws InvalidTypeException If any expression evaluation fails
     */
}

Implementation Details:

  • Evaluates the first expression against the original input
  • Each subsequent expression uses the previous result as input
  • Returns the final result from the last expression

Multi-Select List Evaluation

Evaluates multiple expressions against the same input and returns an array of results.

public JsonNode visit(JmesPathMultiSelectList multiSelectList, JsonNode input) throws InvalidTypeException {
    /**
     * Evaluates multiple expressions and collects results into an array
     * @param multiSelectList The multi-select expression containing sub-expressions
     * @param input The input JSON node to evaluate against
     * @return ArrayNode containing results from all expressions
     * @throws InvalidTypeException If any expression evaluation fails
     */
}

Projection Evaluation

Evaluates list projections by applying an expression to each element of an array.

public JsonNode visit(JmesPathProjection jmesPathProjection, JsonNode input) throws InvalidTypeException {
    /**
     * Evaluates list projection expressions
     * @param jmesPathProjection The projection expression
     * @param input The input JSON node
     * @return ArrayNode with projection results, or NullNode if input not array
     * @throws InvalidTypeException If expression evaluation fails
     */
}

Implementation Details:

  • Left-hand side creates the array to project over
  • Right-hand side expression is applied to each array element
  • Returns NullNode if LHS result is not an array
  • Filters out null results from the projection

Value Projection Evaluation

Evaluates object value projections by creating a list from object values and projecting over them.

public JsonNode visit(JmesPathValueProjection valueProjection, JsonNode input) throws InvalidTypeException {
    /**
     * Evaluates object value projection expressions
     * @param valueProjection The value projection expression
     * @param input The input JSON node
     * @return ArrayNode with projection results, or NullNode if input not object
     * @throws InvalidTypeException If expression evaluation fails
     */
}

Filter Evaluation

Evaluates filter expressions by testing each array element against a condition.

public JsonNode visit(JmesPathFilter filter, JsonNode input) throws InvalidTypeException {
    /**
     * Evaluates filter expressions on arrays
     * @param filter The filter expression with condition
     * @param input The input JSON node
     * @return ArrayNode with filtered results, or NullNode if input not array
     * @throws InvalidTypeException If expression evaluation fails
     */
}

Implementation Details:

  • LHS expression provides the array to filter
  • Comparator expression evaluates to boolean for each element
  • RHS expression is applied to elements that pass the filter
  • Only elements where comparator returns BooleanNode.TRUE are included

Logical Operation Evaluation

Evaluates logical AND and NOT expressions with short-circuit behavior.

public JsonNode visit(JmesPathAndExpression andExpression, JsonNode input) throws InvalidTypeException {
    /**
     * Evaluates logical AND expressions
     * @param andExpression The AND expression with left and right operands
     * @param input The input JSON node
     * @return RHS result if LHS is true, otherwise LHS result
     * @throws InvalidTypeException If expression evaluation fails
     */
}

public JsonNode visit(JmesPathNotExpression notExpression, JsonNode input) throws InvalidTypeException {
    /**
     * Evaluates logical NOT expressions
     * @param notExpression The NOT expression with operand
     * @param input The input JSON node
     * @return BooleanNode.TRUE if operand is falsy, BooleanNode.FALSE otherwise
     * @throws InvalidTypeException If expression evaluation fails
     */
}

Array Flattening Evaluation

Flattens nested arrays by one level.

public JsonNode visit(JmesPathFlatten flatten, JsonNode input) throws InvalidTypeException {
    /**
     * Evaluates array flattening expressions
     * @param flatten The flatten expression
     * @param input The input JSON node
     * @return Flattened ArrayNode, or NullNode if input not array
     * @throws InvalidTypeException If expression evaluation fails
     */
}

Implementation Details:

  • Evaluates the flatten expression to get an array
  • Iterates through array elements
  • Non-array elements are added directly
  • Array elements have their contents added individually
  • Returns a single flattened array

Function Evaluation

Evaluates function expressions by processing arguments and calling the function's evaluate method.

public JsonNode visit(JmesPathFunction function, JsonNode input) throws InvalidTypeException {
    /**
     * Evaluates function expressions in applicative order
     * @param function The function expression with arguments
     * @param input The input JSON node
     * @return The result of the function evaluation
     * @throws InvalidTypeException If function evaluation fails
     */
}

Implementation Details:

  • Evaluates all function arguments against the input
  • Calls the function's evaluate method with evaluated arguments
  • Returns the function's result

Comparison Evaluation

Evaluates comparison expressions by comparing left and right operands.

public JsonNode visit(Comparator op, JsonNode input) throws InvalidTypeException {
    /**
     * Evaluates comparison expressions
     * @param op The comparison operator
     * @param input The input JSON node
     * @return BooleanNode.TRUE if comparison matches, BooleanNode.FALSE otherwise
     * @throws InvalidTypeException If expression evaluation fails
     */
}

Install with Tessl CLI

npx tessl i tessl/maven-com-amazonaws--jmespath-java

docs

advanced-expressions.md

built-in-functions.md

comparison-operations.md

core-expressions.md

expression-evaluation.md

index.md

tile.json