Package cc.plural.jsonij.jpath.functions

Examples of cc.plural.jsonij.jpath.functions.RegexFunction


                                FunctionExpressionPredicateCondition functionCondition = (FunctionExpressionPredicateCondition) condition;
                                String functionName = functionCondition.getFunctionName();
                                FunctionArgument[] funtionArguments = functionCondition.getArguments();

                                if(functionName.equals("regex")) {
                                    RegexFunction regexFunction = new RegexFunction();
                                    Value result = regexFunction.evaluate(funtionArguments, checkElement);
                                    if(result == null) {
                                        expressionValid = false;
                                        break;
                                    }
                                }
                            }
                        }

                        if (expressionValid) {
                            results.add(checkElement);
                        }
                    }
                }
            } else {
                if(value.getValueType() == Value.TYPE.OBJECT) {

                    boolean expressionValid = true;
                    for (ExpressionPredicateCondition condition : conditions) {
                        if (condition instanceof OperatorExpressionPredicateCondition) {
                            OperatorExpressionPredicateCondition operatorCondition = (OperatorExpressionPredicateCondition) condition;
                            Value checkValue = value.get(operatorCondition.getAttribute());
                            if (checkValue == null) {
                                expressionValid = false;
                                break;
                            }
                            ExpressionPredicateOperator expressionConditionOperator = operatorCondition.getOperator();
                            if (expressionConditionOperator.equals(ExpressionPredicateOperator.NOT_NULL)) {
                                if (checkValue.isNull()) {
                                    expressionValid = false;
                                    break;
                                }
                            } else if (expressionConditionOperator.equals(ExpressionPredicateOperator.EQUAL)) {
                                if (!checkValue.equals(operatorCondition.value)) {
                                    expressionValid = false;
                                    break;
                                }
                            } else if (expressionConditionOperator.equals(ExpressionPredicateOperator.LESS)) {
                            } else if (expressionConditionOperator.equals(ExpressionPredicateOperator.GREATER)) {
                            } else if (expressionConditionOperator.equals(ExpressionPredicateOperator.LESS_EQUAL)) {
                            } else if (expressionConditionOperator.equals(ExpressionPredicateOperator.GREATER_EQUAL)) {
                            }
                        } else if (condition instanceof FunctionExpressionPredicateCondition) {
                            FunctionExpressionPredicateCondition functionCondition = (FunctionExpressionPredicateCondition) condition;
                            String functionName = functionCondition.getFunctionName();
                            FunctionArgument[] funtionArguments = functionCondition.getArguments();

                            if(functionName.equals("regex")) {
                                RegexFunction regexFunction = new RegexFunction();
                                Value result = regexFunction.evaluate(funtionArguments, value);
                                if(result != null) {
                                    results.add(value);
                                }
                            }
                        }
View Full Code Here

TOP

Related Classes of cc.plural.jsonij.jpath.functions.RegexFunction

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.