use of org.hibernate.query.sqm.tree.SqmVisitableNode in project hibernate-orm by hibernate.
the class SelfRenderingSqmFunction method resolveSqlAstArguments.
protected List<SqlAstNode> resolveSqlAstArguments(List<? extends SqmTypedNode<?>> sqmArguments, SqmToSqlAstConverter walker) {
if (sqmArguments == null || sqmArguments.isEmpty()) {
return emptyList();
}
final FunctionArgumentTypeResolver argumentTypeResolver;
if (getFunctionDescriptor() instanceof AbstractSqmFunctionDescriptor) {
argumentTypeResolver = ((AbstractSqmFunctionDescriptor) getFunctionDescriptor()).getArgumentTypeResolver();
} else {
argumentTypeResolver = null;
}
if (argumentTypeResolver == null) {
final ArrayList<SqlAstNode> sqlAstArguments = new ArrayList<>(sqmArguments.size());
for (int i = 0; i < sqmArguments.size(); i++) {
sqlAstArguments.add((SqlAstNode) ((SqmVisitableNode) sqmArguments.get(i)).accept(walker));
}
return sqlAstArguments;
}
final FunctionArgumentTypeResolverTypeAccess typeAccess = new FunctionArgumentTypeResolverTypeAccess(walker, this, argumentTypeResolver);
final ArrayList<SqlAstNode> sqlAstArguments = new ArrayList<>(sqmArguments.size());
for (int i = 0; i < sqmArguments.size(); i++) {
typeAccess.argumentIndex = i;
sqlAstArguments.add((SqlAstNode) walker.visitWithInferredType((SqmVisitableNode) sqmArguments.get(i), typeAccess));
}
return sqlAstArguments;
}
Aggregations