Package org.apache.cayenne.exp

Examples of org.apache.cayenne.exp.ExpressionException


        }
        else if (object instanceof Number) {
            return new BigDecimal(((Number) object).doubleValue());
        }

        throw new ExpressionException("Can't convert to BigDecimal: " + object);
    }
View Full Code Here


        this.dbAttributeRemoved(new AttributeEvent(this, null, this, MapEvent.REMOVE));
    }

    public Iterator resolvePathComponents(Expression pathExp) throws ExpressionException {
        if (pathExp.getType() != Expression.DB_PATH) {
            throw new ExpressionException("Invalid expression type: '"
                    + pathExp.expName()
                    + "',  DB_PATH is expected.");
        }

        return new PathIterator((String) pathExp.getOperand(0));
View Full Code Here

            // see if this is an attribute
            Attribute attr = currentEnt.getAttribute(pathComp);
            if (attr != null) {
                // do a sanity check...
                if (toks.hasMoreTokens()) {
                    throw new ExpressionException(
                            "Attribute must be the last component of the path: '"
                                    + pathComp
                                    + "'.",
                            path,
                            null);
                }

                return attr;
            }

            Relationship rel = currentEnt.getRelationship(pathComp);
            if (rel != null) {
                currentEnt = rel.getTargetEntity();
                return rel;
            }

            // build error message
            StringBuffer buf = new StringBuffer();
            buf
                    .append("Can't resolve path component: [")
                    .append(currentEnt.getName())
                    .append('.')
                    .append(pathComp)
                    .append("].");
            throw new ExpressionException(buf.toString(), path, null);
        }
View Full Code Here

        // in the grammar... do it here...

        // disallow non-aggregated condition parents...
        if (!(n instanceof AggregateConditionNode)) {
            String label = (n instanceof SimpleNode) ? ((SimpleNode)n).expName() : String.valueOf(n);
            throw new ExpressionException(expName() + ": invalid parent - " + label);
        }

        super.jjtSetParent(n);
    }
View Full Code Here

        if (!(n instanceof AggregateConditionNode)) {
            String label =
                (n instanceof SimpleNode)
                    ? ((SimpleNode) n).expName()
                    : String.valueOf(n);
            throw new ExpressionException(expName() + ": invalid parent - " + label);
        }

        super.jjtSetParent(n);
    }
View Full Code Here

        if (!(n instanceof ConditionNode) && !(n instanceof AggregateConditionNode)) {
            String label =
                (n instanceof SimpleNode)
                    ? ((SimpleNode) n).expName()
                    : String.valueOf(n);
            throw new ExpressionException(expName() + ": invalid child - " + label);
        }

        super.jjtAddChild(n, i);
    }
View Full Code Here

        super(ExpressionParserTreeConstants.JJTNAMEDPARAMETER);
        setValue(value);
    }

    protected Object evaluateNode(Object o) throws Exception {
        throw new ExpressionException(
            "Uninitialized parameter: " + value + ", call 'expWithParameters' first.");
    }
View Full Code Here

        return copy;
    }

    public void setValue(Object value) {
        if (value == null) {
            throw new ExpressionException("Null Parameter value");
        }

        String name = value.toString().trim();
        if (name.length() == 0) {
            throw new ExpressionException("Empty Parameter value");
        }

        super.setValue(new ExpressionParameter(name));
    }
View Full Code Here

        if (!(n instanceof AggregateConditionNode)) {
            String label =
                (n instanceof SimpleNode)
                    ? ((SimpleNode) n).expName()
                    : String.valueOf(n);
            throw new ExpressionException(expName() + ": invalid parent - " + label);
        }

        super.jjtSetParent(n);
    }
View Full Code Here

        if (!(n instanceof ConditionNode) && !(n instanceof AggregateConditionNode)) {
            String label =
                (n instanceof SimpleNode)
                    ? ((SimpleNode) n).expName()
                    : String.valueOf(n);
            throw new ExpressionException(expName() + ": invalid child - " + label);
        }

        super.jjtAddChild(n, i);
    }
View Full Code Here

TOP

Related Classes of org.apache.cayenne.exp.ExpressionException

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.