/** * Adds all interfaces implemented/extended by the class, including those of its ancestors. * * @param interfaze the class to introspect * @param interfaces the collection of interfaces to add to */ private void addInterfaces(Class<?> interfaze, List<String> interfaces) { for (Class<?> superInterface : interfaze.getInterfaces()) { if (!interfaces.contains(superInterface.getName())) { interfaces.add(superInterface.getName()); addInterfaces(superInterface, interfaces); } } }
private void introspectInterface(Class<?> interfaceClass) { this.interfaceClass = interfaceClass; methodSignatures = new ArrayList<>(); Class<?> superClass = interfaceClass.getSuperclass(); if (superClass != null) { superType = superClass.getName(); } interfaces = new ArrayList<>(); for (Method method : interfaceClass.getDeclaredMethods()) { Signature signature = new Signature(method); if (!methodSignatures.contains(signature)) { methodSignatures.add(signature); } } addInterfaces(interfaceClass, interfaces); }