public static <T> T visitQuery(@NotNull final Method method, @NotNull final QueryVisitor<T> visitor) {
final Finder finder = AnnotationUtils.findAnnotation(method, Finder.class);
if (StringUtils.hasText(finder.query())) {
return visitor.visitQuery(finder.query());
} else if (StringUtils.hasText(finder.sqlQuery())) {
return visitor.visitSQLQuery(finder.sqlQuery());
} else if (StringUtils.hasText(finder.sqlQueryName())) {
return visitor.visitSQLNamedQuery(finder.sqlQueryName());
} else {
Assert.hasText(finder.queryName());
return visitor.visitNamedQuery(finder.queryName());