1 |
package dk.thoerup.circuitbreaker.notification; |
2 |
|
3 |
public class NotiferHelper { |
4 |
public static String getName(Notifier notif) { |
5 |
StringBuilder sb = new StringBuilder(); |
6 |
sb.append(notif.getClass().getSimpleName()); |
7 |
|
8 |
if (notif instanceof CompositeNotifier) { |
9 |
CompositeNotifier composite = (CompositeNotifier) notif; |
10 |
sb.append("("); |
11 |
for (int i=0; i<composite.children.size(); i++) { |
12 |
Notifier n = composite.children.get(i); |
13 |
|
14 |
if (i > 0) { |
15 |
sb.append(","); |
16 |
} |
17 |
sb.append( getName(n) ); |
18 |
} |
19 |
sb.append(")"); |
20 |
} |
21 |
|
22 |
return sb.toString(); |
23 |
} |
24 |
} |