use of org.datanucleus.query.expression.InvokeExpression in project datanucleus-api-jdo by datanucleus.
the class StringExpressionImpl method matches.
public BooleanExpression matches(String str) {
List<org.datanucleus.query.expression.Expression> args = new ArrayList();
args.add(new Literal(str));
org.datanucleus.query.expression.Expression invokeExpr = new InvokeExpression(queryExpr, "matches", args);
return new BooleanExpressionImpl(invokeExpr);
}
use of org.datanucleus.query.expression.InvokeExpression in project datanucleus-api-jdo by datanucleus.
the class StringExpressionImpl method endsWith.
/* (non-Javadoc)
* @see org.datanucleus.query.typesafe.StringExpression#endsWith(java.lang.String)
*/
public BooleanExpression endsWith(String str) {
List<org.datanucleus.query.expression.Expression> args = new ArrayList();
args.add(new Literal(str));
org.datanucleus.query.expression.Expression invokeExpr = new InvokeExpression(queryExpr, "endsWith", args);
return new BooleanExpressionImpl(invokeExpr);
}
use of org.datanucleus.query.expression.InvokeExpression in project datanucleus-api-jdo by datanucleus.
the class StringExpressionImpl method charAt.
/* (non-Javadoc)
* @see org.datanucleus.query.typesafe.StringExpression#charAt(int)
*/
public CharacterExpression charAt(int pos) {
List<org.datanucleus.query.expression.Expression> args = new ArrayList();
args.add(new Literal(pos));
org.datanucleus.query.expression.Expression invokeExpr = new InvokeExpression(queryExpr, "charAt", args);
return new CharacterExpressionImpl(invokeExpr);
}
use of org.datanucleus.query.expression.InvokeExpression 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.InvokeExpression 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