Example #1
0
 Annotation[] extractAnnotations(
     TreeLogger logger,
     JClassType type,
     JMethod ifaceMethod,
     JMethod classMethod,
     GeneratorContext ctx) {
   Map<Class<?>, Annotation> unique = new LinkedHashMap<Class<?>, Annotation>();
   // Prefer annotation on classes before interfaces.
   for (Annotation classAnno : classMethod.getAnnotations()) {
     unique.put(classAnno.annotationType(), classAnno);
   }
   // Transverse supertypes
   JClassType next = type.getSuperclass();
   while (next != null) {
     JMethod method = next.findMethod(ifaceMethod.getName(), ifaceMethod.getParameterTypes());
     if (method != null)
       for (Annotation classAnno : method.getAnnotations()) {
         unique.put(classAnno.annotationType(), classAnno);
       }
     next = next.getSuperclass();
   }
   for (Annotation ifaceAnno : ifaceMethod.getAnnotations()) {
     unique.put(ifaceAnno.annotationType(), ifaceAnno);
   }
   return unique.values().toArray(new Annotation[unique.size()]);
 }
Example #2
0
 void implementMethod(TreeLogger logger, JMethod ifaceMethod, GeneratorContext ctx) {
   logger.log(Type.INFO, "Implementing model method " + ifaceMethod.getJsniSignature());
   toGenerate.add(xapi.dev.model.ModelGeneratorGwt.toSignature(ifaceMethod));
   applyAnnotations(logger, ifaceMethod, ifaceMethod.getAnnotations(), ctx);
 }