/** * Evaluates function expression in applicative order. Each * argument is an expression, each argument expression is * evaluated before evaluating the function. The function is * then called with the evaluated function arguments. The * result of the function-expression is the result returned * by the function call. * * @param function JmesPath function type * @param input Input json node against which evaluation is done * @return Result of the function evaluation * @throws InvalidTypeException */ @Override public JsonNode visit(JmesPathFunction function, JsonNode input) throws InvalidTypeException { List<JsonNode> evaluatedArguments = new ArrayList<JsonNode>(); List<JmesPathExpression> arguments = function.getExpressions(); for (JmesPathExpression arg : arguments) { evaluatedArguments.add(arg.accept(this, input)); } return function.evaluate(evaluatedArguments); }
/** * Generates the code for a new JmesPathFunction. * * @param function JmesPath function type * @param aVoid void * @return String that represents a call to * the new function expression * @throws InvalidTypeException */ @Override public String visit(final JmesPathFunction function, final Void aVoid) throws InvalidTypeException { final String prefix = "new " + function.getClass() .getSimpleName() + "( "; return function.getExpressions().stream() .map(a -> a.accept(this, aVoid)) .collect(Collectors.joining(",", prefix, ")")); }
/** * Generates the code for a new JmesPathFunction. * * @param function JmesPath function type * @param aVoid void * @return String that represents a call to * the new function expression * @throws InvalidTypeException */ @Override public String visit(final JmesPathFunction function, final Void aVoid) throws InvalidTypeException { final String prefix = "new " + function.getClass() .getSimpleName() + "( "; return function.getExpressions().stream() .map(a -> a.accept(this, aVoid)) .collect(Collectors.joining(",", prefix, ")")); }
/** * Evaluates function expression in applicative order. Each * argument is an expression, each argument expression is * evaluated before evaluating the function. The function is * then called with the evaluated function arguments. The * result of the function-expression is the result returned * by the function call. * * @param function JmesPath function type * @param input Input json node against which evaluation is done * @return Result of the function evaluation * @throws InvalidTypeException */ @Override public JsonNode visit(JmesPathFunction function, JsonNode input) throws InvalidTypeException { List<JsonNode> evaluatedArguments = new ArrayList<JsonNode>(); List<JmesPathExpression> arguments = function.getExpressions(); for (JmesPathExpression arg : arguments) { evaluatedArguments.add(arg.accept(this, input)); } return function.evaluate(evaluatedArguments); }
/** * Evaluates function expression in applicative order. Each * argument is an expression, each argument expression is * evaluated before evaluating the function. The function is * then called with the evaluated function arguments. The * result of the function-expression is the result returned * by the function call. * * @param function JmesPath function type * @param input Input json node against which evaluation is done * @return Result of the function evaluation * @throws InvalidTypeException */ @Override public JsonNode visit(JmesPathFunction function, JsonNode input) throws InvalidTypeException { List<JsonNode> evaluatedArguments = new ArrayList<JsonNode>(); List<JmesPathExpression> arguments = function.getExpressions(); for (JmesPathExpression arg : arguments) { evaluatedArguments.add(arg.accept(this, input)); } return function.evaluate(evaluatedArguments); }