List of utility methods to do Reflection Interface Get
List | getInterfaces(final Class> type) Returns all interfaces of this class and its super's. List<Class<?>> interfaces = new ArrayList<Class<?>>(); if (type.isInterface()) { interfaces.add(type); } else { Class<?> loop = type; while (!loop.equals(Object.class)) { for (Class<?> interfacez : loop.getInterfaces()) { interfaces.add(interfacez); ... |
ArrayList | getInterfaces(Object owner, String[] interfaceStrings) get interface classes which the object implemented ArrayList<Class<?>> targetInterfaces = new ArrayList<Class<?>>(); Class<?>[] interfaceClasses = owner.getClass().getInterfaces(); for (Class<?> interfaceClass : interfaceClasses) { for (String interfaceName : interfaceStrings) { if (interfaceClass.getName().contains(interfaceName)) { targetInterfaces.add(interfaceClass); return targetInterfaces; |
List | getInterfacesForClass(Class> type) A simple but efficient method for getting the interfaces for a class type, this has some shortcuts for the common types like maps, lists, etc. Only returns the interfaces for the current type and not for all nested types ArrayList<Class<?>> interfaces = new ArrayList<Class<?>>(); for (Class<?> iface : type.getInterfaces()) { interfaces.add(iface); if (isClassCollection(type)) { if (isClassList(type)) { interfaces.add(List.class); } else if (Set.class.isAssignableFrom(type)) { ... |
List | getInterfacesList(Class clazz) get Interfaces List List<Class> result = new ArrayList<Class>(); Class[] interfaces = clazz.getInterfaces(); if (null != interfaces && interfaces.length > 0) { for (Class intrfc : interfaces) { result.add(intrfc); result.addAll(getInterfacesList(intrfc)); return result; |
Class[] | getParentAllInterfaces(Class pojoClass) get Parent All Interfaces Class[] interfaces = null; try { List interfacesL = new ArrayList(); while (pojoClass != null) { for (int i = 0; i < pojoClass.getInterfaces().length; i++) { Class ifc = pojoClass.getInterfaces()[i]; if (!ifc.getName().startsWith("java.")) interfacesL.add(ifc); ... |
List | getPortNameAndSuffixFromInterfaceName(String intfName) get Port Name And Suffix From Interface Name List<String> strList = new ArrayList<>(2); int index = intfName.indexOf(":"); if (index != -1) { strList.add(0, intfName.substring(0, index)); strList.add(1, intfName.substring(index)); return strList; |