Package org.apache.expreval.expr.node

Examples of org.apache.expreval.expr.node.GenericValue


    }

    public Class<? extends GenericValue> validateTypes(final GenericValue parentExpr,
                                                       final boolean allowCollections) throws HBqlException {

        final GenericValue genericValue = this.getExprArg(0);
        final Class<? extends GenericValue> validatedValue = genericValue.validateTypes(this, false);
        final Class<? extends GenericValue> type = this.getGenericValueClass(validatedValue);

        final GenericNullCompare typedExpr;
        if (TypeSupport.isParentClass(StringValue.class, type))
            typedExpr = new StringNullCompare(this.isNot(), this.getExprArg(0));
View Full Code Here


                           final boolean allowColumns,
                           final boolean allowCollections,
                           final Object object) throws HBqlException, ResultMissingColumnException, NullColumnValueException {
        this.validateTypes(allowColumns, allowCollections);
        this.optimize();
        final GenericValue genericValue = this.getGenericValue(i);
        return genericValue.getValue(conn, object);
    }
View Full Code Here

    public GenericValue getLeftAssociativeBooleanCompare(final List<GenericValue> exprList,
                                                         final List<Operator> opList) {
        if (exprList.size() == 1)
            return exprList.get(0);

        GenericValue root = new BooleanCompare(exprList.get(0), opList.get(0), exprList.get(1));

        for (int i = 1; i < opList.size(); i++)
            root = new BooleanCompare(root, opList.get(i), exprList.get(i + 1));

        return root;
View Full Code Here


    public static Object parseExpression(final String sql) throws HBqlException {
        try {
            final HBqlParser parser = ParserUtil.newHBqlParser(sql);
            final GenericValue valueExpr = parser.exprValue();
            valueExpr.validateTypes(null, false);
            return valueExpr.getValue(null, null);
        }
        catch (ResultMissingColumnException e) {
            // No column refs should be missing
            throw new InternalErrorException("Missing column: " + e.getMessage());
        }
View Full Code Here

    public GenericValue getLeftAssociativeCalculation(final List<GenericValue> exprList,
                                                      final List<Operator> opList) {
        if (exprList.size() == 1)
            return exprList.get(0);

        GenericValue root = new DelegateCalculation(exprList.get(0), opList.get(0), exprList.get(1));

        for (int i = 1; i < opList.size(); i++)
            root = new DelegateCalculation(root, opList.get(i), exprList.get(i + 1));

        return root;
View Full Code Here

            // if it is a list, then ensure that all the types in list are valid and consistent
            if (this.getTypedExprList().size() == 0)
                throw new InvalidTypeException("Parameter " + this.getParamName() + " is assigned a collection with no values");

            // Look at the type of the first item and then make sure the rest match that one
            final GenericValue firstval = this.getTypedExprList().get(0);
            final Class<? extends GenericValue> clazzToMatch = TypeSupport.getGenericExprType(firstval);

            for (final GenericValue val : this.getTypedExprList()) {

                final Class<? extends GenericValue> clazz = TypeSupport.getGenericExprType(val);

                if (clazz == null)
                    throw new InvalidTypeException("Parameter " + this.getParamName()
                                                   + " assigned a collection value with invalid type "
                                                   + firstval.getClass().getSimpleName());

                if (!clazz.equals(clazzToMatch))
                    throw new InvalidTypeException("Parameter " + this.getParamName()
                                                   + " assigned a collection value with type "
                                                   + firstval.getClass().getSimpleName()
                                                   + " which is inconsistent with the type of the first element");
            }

            return clazzToMatch;
        }
View Full Code Here

    public Object getValue(final HConnectionImpl conn, final Object object) throws HBqlException,
                                                                                   ResultMissingColumnException,
                                                                                   NullColumnValueException {
        if (this.isScalarValueSet()) {
            final GenericValue genericValue = this.getTypedExpr();
            return genericValue.getValue(conn, object);
        }
        else
            return this.getTypedExprList();
    }
View Full Code Here

TOP

Related Classes of org.apache.expreval.expr.node.GenericValue

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.