コード例 #1
0
 /**
  * Given an interface and a property, finds the top-most super interface that has the property
  * defined (including this interface).
  */
 public static ObjectType getTopDefiningInterface(ObjectType type, String propertyName) {
   ObjectType foundType = null;
   if (type.hasProperty(propertyName)) {
     foundType = type;
   }
   for (ObjectType interfaceType : type.getCtorExtendedInterfaces()) {
     if (interfaceType.hasProperty(propertyName)) {
       foundType = getTopDefiningInterface(interfaceType, propertyName);
     }
   }
   return foundType;
 }
コード例 #2
0
  private void addRelatedInterfaces(ObjectType instance, Set<ObjectType> set) {
    FunctionType constructor = instance.getConstructor();
    if (constructor != null) {
      if (!constructor.isInterface()) {
        return;
      }

      if (!set.add(instance)) {
        return;
      }

      for (ObjectType interfaceType : instance.getCtorExtendedInterfaces()) {
        addRelatedInterfaces(interfaceType, set);
      }
    }
  }