/** * Generates the code for a new Comparator. * * @param op JmesPath comparison operator type * @param aVoid void * @return String that represents a call to * the new comparator expression * @throws InvalidTypeException */ @Override public String visit(final Comparator op, final Void aVoid) throws InvalidTypeException { String lhs = op.getLhsExpr().accept(this, aVoid); String rhs = op.getRhsExpr().accept(this, aVoid); return String.format("new %s(%s, %s)", op.getClass() .getSimpleName(), lhs, rhs); }
/** * Evaluate the expressions as per the given comparison * operator. * * @param op JmesPath comparison operator type * @param input Input json node against which evaluation is done * @return Result of the comparison */ @Override public JsonNode visit(Comparator op, JsonNode input) { JsonNode lhsNode = op.getLhsExpr().accept(this, input); JsonNode rhsNode = op.getRhsExpr().accept(this, input); if (op.matches(lhsNode, rhsNode)) { return BooleanNode.TRUE; } return BooleanNode.FALSE; }
/** * Generates the code for a new Comparator. * * @param op JmesPath comparison operator type * @param aVoid void * @return String that represents a call to * the new comparator expression * @throws InvalidTypeException */ @Override public String visit(final Comparator op, final Void aVoid) throws InvalidTypeException { String lhs = op.getLhsExpr().accept(this, aVoid); String rhs = op.getRhsExpr().accept(this, aVoid); return String.format("new %s(%s, %s)", op.getClass() .getSimpleName(), lhs, rhs); }
/** * Evaluate the expressions as per the given comparison * operator. * * @param op JmesPath comparison operator type * @param input Input json node against which evaluation is done * @return Result of the comparison */ @Override public JsonNode visit(Comparator op, JsonNode input) { JsonNode lhsNode = op.getLhsExpr().accept(this, input); JsonNode rhsNode = op.getRhsExpr().accept(this, input); if (op.matches(lhsNode, rhsNode)) { return BooleanNode.TRUE; } return BooleanNode.FALSE; }
/** * Evaluate the expressions as per the given comparison * operator. * * @param op JmesPath comparison operator type * @param input Input json node against which evaluation is done * @return Result of the comparison */ @Override public JsonNode visit(Comparator op, JsonNode input) { JsonNode lhsNode = op.getLhsExpr().accept(this, input); JsonNode rhsNode = op.getRhsExpr().accept(this, input); if (op.matches(lhsNode, rhsNode)) { return BooleanNode.TRUE; } return BooleanNode.FALSE; }