Ejemplo n.º 1
0
  /**
   * *************************************************************************************************
   *
   * <p>Determine if a class implements a specific collection of interfaces or not.
   *
   * @param class_i The class to check for interface implementation.
   * @param desiredInterfaceClasses_i The collection of interfaces that are needed.
   * @return the <CODE>true</CODE> if all interfaces are implemented; otherwise, <CODE>false</CODE>.
   *     <p>*************************************************************************************************
   */
  public static boolean implementsInterfaces(Class class_i, Class[] desiredInterfaceClasses_i) {
    Set neededInterfaces = new HashSet(desiredInterfaceClasses_i.length);
    ArrayUtils.populateCollection(neededInterfaces, desiredInterfaceClasses_i);

    for (Class currentClass = class_i;
        !neededInterfaces.isEmpty() && (currentClass != null);
        currentClass = currentClass.getSuperclass()) {
      if (ReflectionUtils.implementsInterfaces(currentClass, neededInterfaces)) {
        return true;
      }
    }

    return false;
  }