Package cc.plural.jsonij

Examples of cc.plural.jsonij.Value


                                expressionStringBuilder.append(c);
                                predicateComponentBuilder.append(c);
                            }
                            value = predicateComponentBuilder.toString().trim();
                            ThreadSafeJSONParser jsonParser = new ThreadSafeJSONParser();
                            Value jsonValue = jsonParser.parseValue(value);
                            target.skipWhitepace(expressionStringBuilder);
                            OperatorExpressionPredicateCondition predicateCondition = new OperatorExpressionPredicateCondition(attribute, expressionPredicateOperator, jsonValue);
                            if(op != null) {
                                predicateCondition.setCombine(op);
                                op = null;
View Full Code Here


        return String.format("KeyComponent [%s]", value);
    }

    @Override
    public List<Value> evaluate(List<Value> values, List<Value> results) {
        Value valueStore = null;
        for(Value currentValue: values) {
            String keyValue = getValue();
            if(currentValue.getValueType() == Value.TYPE.OBJECT) {
                valueStore = currentValue.get(keyValue);
                if(valueStore != null) {
View Full Code Here

    public List<Value> evaluate(List<Value> values, List<Value> results) {

        for (Value value : values) {
            if (value.getValueType() == Value.TYPE.ARRAY) {
                for (int j = 0; j < value.size(); j++) {
                    Value checkElement = value.get(j);
                    if (checkElement.getValueType() == Value.TYPE.OBJECT) {
                        boolean expressionValid = true;
                        for (ExpressionPredicateCondition condition : conditions) {
                            if (condition instanceof OperatorExpressionPredicateCondition) {
                                OperatorExpressionPredicateCondition operatorCondition = (OperatorExpressionPredicateCondition) condition;
                                Value checkValue = checkElement.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, 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

    recordEvaluateTime = false;
    lastEvaluateTime = -1;
  }

  public Value evaluate(JSON json) throws JPathRuntimeException {
    Value value = json.getRoot();
    return evaluate(value);
  }
View Full Code Here

    Value value = json.getRoot();
    return evaluate(value);
  }

  public Value[] evaluateAll(JSON json) throws JPathRuntimeException {
    Value value = json.getRoot();
    return evaluateAll(value);
  }
View Full Code Here

        // Find an object inspector
        Inspection inspection = ReflectType.getInspection(objectClass);

        HashMap<String, Value> valueCollector = new HashMap<String, Value>();
        List<ClassProperty> properties = inspection.getProperties();
        Value value;
        int propCount = 0;
        for (ClassProperty property : properties) {
//            if(property.isCollector()) {
//                continue;
//            }
View Full Code Here

        }

    }

    protected Value marshalObjectMethodValue(Method method, Object o, CycleDetector cycleDetector) throws IllegalAccessException, IllegalArgumentException, InvocationTargetException, JSONMarshalerException {
        Value value;
        Object marshaledObject = method.invoke(o);
        if (marshaledObject == null) {
            value = null;
        } else {
            int hashCode = marshaledObject.hashCode();
View Full Code Here

        }
        return value;
    }

    protected Value marshalObjectFieldValue(Field field, Object o, CycleDetector cycleDetector) throws IllegalArgumentException, IllegalAccessException, JSONMarshalerException {
        Value value = null;
        Object marshaledObject = field.get(o);
        if (marshaledObject == null) {
            value = null;
        } else {
            int hashCode = marshaledObject.hashCode();
View Full Code Here

                                expressionStringBuilder.append(c);
                                predicateComponentBuilder.append(c);
                            }
                            value = predicateComponentBuilder.toString().trim();
                            ThreadSafeJSONParser jsonParser = new ThreadSafeJSONParser();
                            Value jsonValue = jsonParser.parseValue(value);
                            target.skipWhitepace(expressionStringBuilder);
                            OperatorExpressionPredicateCondition predicateCondition = new OperatorExpressionPredicateCondition(attribute, expressionPredicateOperator, jsonValue);
                            if(op != null) {
                                predicateCondition.setCombine(op);
                                op = null;
View Full Code Here

        Value marshaledArray = JAVA_MARSHALLER.marshalObject(a);
        return marshaledArray;
    }

    public static Value marshalObjectToValue(Float[] a) {
        Value marshaledArray = JAVA_MARSHALLER.marshalObject(a);
        return marshaledArray;
    }
View Full Code Here

TOP

Related Classes of cc.plural.jsonij.Value

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.