1 package com.atlassian.plugin.util;
2
3 import java.util.Set;
4 import java.util.HashSet;
5
6
7
8
9 public class ClassUtils
10 {
11 private ClassUtils() {}
12
13
14
15
16
17
18 public static Set<Class> findAllTypes(Class cls)
19 {
20 Set<Class> types = new HashSet<Class>();
21 findAllTypes(cls, types);
22 return types;
23 }
24
25
26
27
28
29
30 public static void findAllTypes(Class cls, Set<Class> types)
31 {
32 if (cls == null)
33 return;
34
35
36 if (types.contains(cls))
37 return;
38
39 types.add(cls);
40
41 findAllTypes(cls.getSuperclass(), types);
42 for (int x = 0; x<cls.getInterfaces().length; x++)
43 findAllTypes(cls.getInterfaces()[x], types);
44 }
45 }