MCPcopy Create free account
hub / github.com/banq/jdonframework / getAllInterfaces

Method getAllInterfaces

src/main/java/com/jdon/util/ClassUtil.java:50–71  ·  view source on GitHub ↗
(Class clazz)

Source from the content-addressed store, hash-verified

48 }
49
50 public static Class[] getAllInterfaces(Class clazz) {
51 if (clazz == null) {
52 return new Class[0];
53 }
54 Set<Class> classList = new HashSet<Class>();
55 while (clazz != null) {
56 Class[] interfaces = clazz.getInterfaces();
57 for (Class interf : interfaces) {
58 if (!classList.contains(interf)) {
59 classList.add(interf);
60 }
61 Class[] superInterfaces = getAllInterfaces(interf);
62 for (Class superIntf : superInterfaces) {
63 if (!classList.contains(superIntf)) {
64 classList.add(superIntf);
65 }
66 }
67 }
68 clazz = clazz.getSuperclass();
69 }
70 return classList.toArray(new Class[classList.size()]);
71 }
72
73 public static Field[] getAllDecaredFields(Class clazz) {
74 List<Field> fields = new ArrayList<Field>();

Callers

nothing calls this directly

Calls 4

getInterfacesMethod · 0.65
sizeMethod · 0.65
containsMethod · 0.45
addMethod · 0.45

Tested by

no test coverage detected