private QueryMethod chooseQueryMethodStrategy(
     Method method, RepositoryMetadata metadata, Class<?> repositoryInterface) {
   QueryMethod queryMethod;
   boolean paramAnnotation = false;
   if ((paramAnnotation = hasParamAnnotation(method))
       || repositoryInterface.isAnnotationPresent(Namespace.class)
       || method.isAnnotationPresent(Statement.class)) {
     queryMethod = new AnnotationBasedSqlMapQueryMethod(method, metadata, paramAnnotation);
   } else {
     queryMethod = new QueryMethod(method, metadata);
   }
   return queryMethod;
 }
示例#2
0
  /**
   * Framework, library, etc, will use something like this to parse annotated class.
   *
   * <p>Here we use java reflection.
   */
  public static void main(String[] args) {

    Class<AnnotatedClass> ac = AnnotatedClass.class;

    System.out.println(ac.isAnnotationPresent(MyAnno.class));
  }