Package org.apache.cayenne.exp

Examples of org.apache.cayenne.exp.Expression.evaluate()


        throw e;
      }
    }
   
    try {
          value2 = exp.evaluate(o2);
    } catch (ExpressionException e) {
      if (pathExceptionSuppressed && e.getCause() instanceof org.apache.cayenne.reflect.UnresolvablePathException) {
        //do nothing, we expect this
      } else {
        //rethrow
View Full Code Here


    public int compare(Object o1, Object o2) {
        Expression exp = getSortSpec();
    Object value1 = null;
    Object value2 = null;
    try {
          value1 = exp.evaluate(o1);
    } catch (ExpressionException e) {
      if (pathExceptionSuppressed && e.getCause() instanceof org.apache.cayenne.reflect.UnresolvablePathException) {
        //do nothing, we expect this
      } else {
        //rethrow
View Full Code Here

        throw e;
      }
    }
   
    try {
          value2 = exp.evaluate(o2);
    } catch (ExpressionException e) {
      if (pathExceptionSuppressed && e.getCause() instanceof org.apache.cayenne.reflect.UnresolvablePathException) {
        //do nothing, we expect this
      } else {
        //rethrow
View Full Code Here

    public int compare(Object o1, Object o2) {
        Expression exp = getSortSpec();
    Object value1 = null;
    Object value2 = null;
    try {
          value1 = exp.evaluate(o1);
    } catch (ExpressionException e) {
      if (pathExceptionSuppressed && e.getCause() instanceof org.apache.cayenne.reflect.UnresolvablePathException) {
        //do nothing, we expect this
      } else {
        //rethrow
View Full Code Here

        throw e;
      }
    }
   
    try {
          value2 = exp.evaluate(o2);
    } catch (ExpressionException e) {
      if (pathExceptionSuppressed && e.getCause() instanceof org.apache.cayenne.reflect.UnresolvablePathException) {
        //do nothing, we expect this
      } else {
        //rethrow
View Full Code Here

     * Comparable interface implementation. Can compare two Java Beans based on the stored
     * expression.
     */
    public int compare(Object o1, Object o2) {
        Expression exp = getSortSpec();
        Object value1 = exp.evaluate(o1);
        Object value2 = exp.evaluate(o2);

        // nulls first policy... maybe make this configurable as some DB do
        if (value1 == null) {
            return (value2 == null) ? 0 : -1;
View Full Code Here

     * expression.
     */
    public int compare(Object o1, Object o2) {
        Expression exp = getSortSpec();
        Object value1 = exp.evaluate(o1);
        Object value2 = exp.evaluate(o2);

        // nulls first policy... maybe make this configurable as some DB do
        if (value1 == null) {
            return (value2 == null) ? 0 : -1;
        }
View Full Code Here

        Expression e = Expression.fromString("db:paintingArray.PAINTING_TITLE");

        ObjEntity ae = runtime.getDataDomain().getEntityResolver().getObjEntity(Artist.class);
        DbEntity ade = ae.getDbEntity();

        Object objTarget = e.evaluate(ae);
        assertTrue(objTarget instanceof DbAttribute);

        Object dbTarget = e.evaluate(ade);
        assertTrue(dbTarget instanceof DbAttribute);
    }
View Full Code Here

        DbEntity ade = ae.getDbEntity();

        Object objTarget = e.evaluate(ae);
        assertTrue(objTarget instanceof DbAttribute);

        Object dbTarget = e.evaluate(ade);
        assertTrue(dbTarget instanceof DbAttribute);
    }

    public void testEvaluateEQUAL_TOBigDecimal() throws Exception {
        BigDecimal bd1 = new BigDecimal("2.0");
View Full Code Here

        assertFalse("Failed: " + notLike, notLike.match(match2));
    }

    public void testEvaluateADD() throws Exception {
        Expression add = new ASTAdd(new Object[] { new Integer(1), new Double(5.5) });
        assertEquals(6.5, ((Number) add.evaluate(null)).doubleValue(), 0.0001);
    }

    public void testEvaluateSubtract() throws Exception {
        Expression subtract = new ASTSubtract(new Object[] { new Integer(1), new Double(0.1), new Double(0.2) });
        assertEquals(0.7, ((Number) subtract.evaluate(null)).doubleValue(), 0.0001);
View Full Code Here

TOP
Copyright © 2018 www.massapi.com. 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.