コード例 #1
0
 /**
  * @param classNode the class node for the interface
  * @return true if this class declares that it implements the given interface or if one of its
  *     interfaces extends directly or indirectly the interface
  *     <p>NOTE: Doesn't consider an interface to implement itself. I think this is intended to be
  *     called on ClassNodes representing classes, not interfaces.
  */
 public boolean declaresInterface(ClassNode classNode) {
   ClassNode[] interfaces = redirect().getInterfaces();
   for (ClassNode cn : interfaces) {
     if (cn.equals(classNode)) return true;
   }
   for (ClassNode cn : interfaces) {
     if (cn.declaresInterface(classNode)) return true;
   }
   return false;
 }
コード例 #2
0
 /**
  * @param classNode the class node for the interface
  * @return true if this class or any base class implements the given interface
  */
 public boolean implementsInterface(ClassNode classNode) {
   ClassNode node = redirect();
   do {
     if (node.declaresInterface(classNode)) {
       return true;
     }
     node = node.getSuperClass();
   } while (node != null);
   return false;
 }