Esempio n. 1
0
 static boolean derivesFrom(Class<?> c, String className) {
   while (c != null) {
     if (c.getName().equals(className)) return true;
     c = c.getSuperclass();
   }
   return false;
 }
Esempio n. 2
0
    public boolean matchesEnclosingType(Method method) {
      TypeRef et = getEnclosingType();
      if (et == null) {
        return true;
      }

      Annotations annotations = annotations(method);
      Class dc = method.getDeclaringClass();
      do {
        if (et.matches(dc, annotations)) {
          return true;
        }

        dc = dc.getSuperclass();
      } while (dc != null && dc != Object.class);

      return false;
    }