use of io.requery.query.function.Case in project requery by requery.
the class DefaultOutput method appendFunction.
private void appendFunction(Function function) {
if (function instanceof Case) {
appendCaseFunction((Case) function);
} else {
Function.Name name = configuration.getMapping().mapFunctionName(function);
qb.append(name.getName());
if (function.arguments().length == 0 && name.isConstant()) {
return;
}
qb.openParenthesis();
int index = 0;
for (Object arg : function.arguments()) {
if (index > 0) {
qb.comma();
}
if (arg instanceof Expression) {
Expression expression = (Expression) arg;
switch(expression.getExpressionType()) {
case ATTRIBUTE:
appendColumnForSelect(expression);
break;
case FUNCTION:
Function inner = (Function) arg;
appendFunction(inner);
break;
default:
qb.append(expression.getName());
break;
}
} else if (arg instanceof Class) {
qb.append("*");
} else {
appendConditionValue(function.expressionForArgument(index), arg);
}
index++;
}
qb.closeParenthesis().space();
}
}
Aggregations