List of utility methods to do Reflection Interface Get
String | addInterfaceName(String name) add Interface Name interfaceNames.add(name);
return null;
|
boolean | equalInterfaces(Object obj1, Object obj2) Returns true if the interfaces implemented by obj1's class are the same (and in the same order) as obj2's class. if (obj1 == obj2) { return true; if ((obj1 == null || obj2 == null) && obj1 != obj2) { return false; Class[] intf1 = getAllInterfaces(obj1); Class[] intf2 = getAllInterfaces(obj2); ... |
List | getAllClassesAndInterfaces(Class startClass) Find all super classes and implemented interfaces for the given class. ArrayList classes = new ArrayList(); addClassesAndInterfaces(startClass, classes); return classes; |
Class[] | getAllInterfaces(Class clazz) get All Interfaces if (clazz == null) { return new Class[0]; List<Class> classList = new ArrayList<Class>(); while (clazz != null) { Class[] interfaces = clazz.getInterfaces(); for (Class interf : interfaces) { if (!classList.contains(interf)) { ... |
Class[] | getAllInterfaces(Class clazz) Returns all of the interfaces implemented by a class. ArrayList result = new ArrayList(); getAllInterfaces(clazz, result); return (Class[]) result.toArray(new Class[0]); |
List | getAllInterfaces(Class clazz) get All Interfaces return getAllInterfaces(clazz, new ArrayList<Class>()); |
List | getAllInterfaces(Class cls) Gets a The order is determined by looking through each interface in turn as declared in the source file and following its hierarchy up. if (cls == null) { return null; List interfacesFound = new ArrayList(); getAllInterfaces(cls, interfacesFound); return interfacesFound; |
List | getAllInterfaces(Class cls) Gets a The order is determined by looking through each interface in turn as declared in the source file and following its hierarchy up. if (cls == null) return null; List list = new ArrayList(); while (cls != null) { Class[] interfaces = cls.getInterfaces(); for (int i = 0; i < interfaces.length; i++) { if (list.contains(interfaces[i]) == false) { list.add(interfaces[i]); ... |
List | getAllInterfaces(Class> base) get All Interfaces List<Class<?>> classes = new ArrayList<>(); Class<?>[] interfaces = base.getInterfaces(); for (Class<?> anInterface : interfaces) { classes.add(anInterface); classes.addAll(getAllInterfaces(anInterface)); return classes; |
Class>[] | getAllInterfaces(Class> clazz) get All Interfaces HashSet<Class<?>> interfaces = new HashSet<>(); getAllInterfaces(clazz, interfaces); return interfaces.toArray(new Class<?>[interfaces.size()]); |