(Object o, Object h)
| 30 | protected static ConcurrentSkipListMap<String, Object> nodes = new ConcurrentSkipListMap<String, Object>(); |
| 31 | |
| 32 | private static String id(Object o, Object h) { |
| 33 | if (o instanceof Field) { |
| 34 | return id(((Field) o).getDeclaringClass(), null) + "." + ((Field) o).getName(); |
| 35 | } |
| 36 | |
| 37 | if (o instanceof String) { |
| 38 | return (String) o; |
| 39 | } |
| 40 | |
| 41 | if (o instanceof Class<?>) { |
| 42 | return ((Class<?>) o).getCanonicalName(); |
| 43 | } |
| 44 | |
| 45 | if (o instanceof Constructor<?>) { |
| 46 | Constructor<?> co = (Constructor<?>) o; |
| 47 | |
| 48 | String mx = ""; |
| 49 | |
| 50 | for (Class<?> i : co.getParameterTypes()) { |
| 51 | mx += "," + i.getCanonicalName(); |
| 52 | } |
| 53 | |
| 54 | mx = mx.length() >= 1 ? mx.substring(1) : mx; |
| 55 | |
| 56 | return id(co.getDeclaringClass(), null) + "(" + mx + ")"; |
| 57 | } |
| 58 | |
| 59 | if (o instanceof Method) { |
| 60 | String mx = ""; |
| 61 | |
| 62 | for (Class<?> i : ((Method) o).getParameterTypes()) { |
| 63 | mx += "," + i.getCanonicalName(); |
| 64 | } |
| 65 | |
| 66 | mx = mx.length() >= 1 ? mx.substring(1) : mx; |
| 67 | |
| 68 | return id(((Method) o).getDeclaringClass(), null) + "." + ((Method) o).getName() + "(" + mx + ")"; |
| 69 | } |
| 70 | |
| 71 | if (o instanceof Annotation) { |
| 72 | Annotation a = (Annotation) o; |
| 73 | return "@" + a.annotationType().getCanonicalName() + "[" + id(h, null) + "]"; |
| 74 | } |
| 75 | |
| 76 | return o.hashCode() + o.toString(); |
| 77 | } |
| 78 | |
| 79 | private static void p(String n, Object o) { |
| 80 | nodes.put(n, o); |
no test coverage detected