use of org.datanucleus.query.expression.Expression in project datanucleus-api-jdo by datanucleus.
the class ComparableExpressionImpl method lt.
/* (non-Javadoc)
* @see org.datanucleus.query.typesafe.Expression#lt(org.datanucleus.query.typesafe.ComparableExpression)
*/
public BooleanExpression lt(ComparableExpression expr) {
Expression leftQueryExpr = queryExpr;
Expression rightQueryExpr = ((ExpressionImpl) expr).getQueryExpression();
org.datanucleus.query.expression.Expression queryExpr = new DyadicExpression(leftQueryExpr, org.datanucleus.query.expression.Expression.OP_LT, rightQueryExpr);
return new BooleanExpressionImpl(queryExpr);
}
use of org.datanucleus.query.expression.Expression in project datanucleus-api-jdo by datanucleus.
the class ComparableExpressionImpl method lteq.
/* (non-Javadoc)
* @see org.datanucleus.query.typesafe.Expression#lteq(java.lang.Object)
*/
public BooleanExpression lteq(T t) {
Expression leftQueryExpr = queryExpr;
Expression rightQueryExpr = new Literal(t);
org.datanucleus.query.expression.Expression queryExpr = new DyadicExpression(leftQueryExpr, org.datanucleus.query.expression.Expression.OP_LTEQ, rightQueryExpr);
return new BooleanExpressionImpl(queryExpr);
}
use of org.datanucleus.query.expression.Expression in project datanucleus-api-jdo by datanucleus.
the class ComparableExpressionImpl method gteq.
/* (non-Javadoc)
* @see org.datanucleus.query.typesafe.Expression#gteq(org.datanucleus.query.typesafe.ComparableExpression)
*/
public BooleanExpression gteq(ComparableExpression expr) {
Expression leftQueryExpr = queryExpr;
Expression rightQueryExpr = ((ExpressionImpl) expr).getQueryExpression();
org.datanucleus.query.expression.Expression queryExpr = new DyadicExpression(leftQueryExpr, org.datanucleus.query.expression.Expression.OP_GTEQ, rightQueryExpr);
return new BooleanExpressionImpl(queryExpr);
}
use of org.datanucleus.query.expression.Expression in project datanucleus-api-jdo by datanucleus.
the class JDOHelperGetObjectIdFunction method evaluate.
/* (non-Javadoc)
* @see org.datanucleus.query.evaluator.memory.InvocationEvaluator#evaluate(org.datanucleus.query.expression.InvokeExpression, org.datanucleus.query.evaluator.memory.InMemoryExpressionEvaluator)
*/
public Object evaluate(InvokeExpression expr, Object invokedValue, InMemoryExpressionEvaluator eval) {
Expression argExpr = expr.getArguments().get(0);
if (argExpr instanceof PrimaryExpression) {
PrimaryExpression primExpr = (PrimaryExpression) argExpr;
Object value = eval.getValueForPrimaryExpression(primExpr);
return JDOHelper.getObjectId(value);
} else if (argExpr instanceof ParameterExpression) {
ParameterExpression paramExpr = (ParameterExpression) argExpr;
Object value = QueryUtils.getValueForParameterExpression(eval.getParameterValues(), paramExpr);
return JDOHelper.getObjectId(value);
} else {
throw new NucleusException("Dont currently support JDOHelper.getObjectId with arg of type " + argExpr.getClass().getName());
}
}
use of org.datanucleus.query.expression.Expression in project datanucleus-api-jdo by datanucleus.
the class JDOHelperGetVersionFunction method evaluate.
/* (non-Javadoc)
* @see org.datanucleus.query.evaluator.memory.InvocationEvaluator#evaluate(org.datanucleus.query.expression.InvokeExpression, org.datanucleus.query.evaluator.memory.InMemoryExpressionEvaluator)
*/
public Object evaluate(InvokeExpression expr, Object invokedValue, InMemoryExpressionEvaluator eval) {
Expression argExpr = expr.getArguments().get(0);
if (argExpr instanceof PrimaryExpression) {
PrimaryExpression primExpr = (PrimaryExpression) argExpr;
Object value = eval.getValueForPrimaryExpression(primExpr);
return JDOHelper.getVersion(value);
} else if (argExpr instanceof ParameterExpression) {
ParameterExpression paramExpr = (ParameterExpression) argExpr;
Object value = QueryUtils.getValueForParameterExpression(eval.getParameterValues(), paramExpr);
return JDOHelper.getVersion(value);
} else {
throw new NucleusException("Dont currently support JDOHelper.getVersion with arg of type " + argExpr.getClass().getName());
}
}
Aggregations