1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19 package org.apache.maven.buildcache;
20
21
22
23
24
25
26
27
28 public class Xpp3DomUtils {
29
30 public static Object[] getChildren(Object node) {
31 try {
32 return (Object[]) node.getClass().getMethod("getChildren").invoke(node);
33 } catch (Exception e) {
34 throw new RuntimeException("Error invoking Xpp3Dom.getChildren", e);
35 }
36 }
37
38 public static String getName(Object node) {
39 try {
40 return (String) node.getClass().getMethod("getName").invoke(node);
41 } catch (Exception e) {
42 throw new RuntimeException("Error invoking Xpp3Dom.getName", e);
43 }
44 }
45
46 public static String getValue(Object node) {
47 try {
48 return (String) node.getClass().getMethod("getValue").invoke(node);
49 } catch (Exception e) {
50 throw new RuntimeException("Error invoking Xpp3Dom.getValue", e);
51 }
52 }
53
54 public static void removeChild(Object node, int index) {
55 try {
56 node.getClass().getMethod("removeChild", int.class).invoke(node, index);
57 } catch (Exception e) {
58 throw new RuntimeException("Error invoking Xpp3Dom.removeChild", e);
59 }
60 }
61
62 public static String getAttribute(Object node, String attribute) {
63 try {
64 return (String)
65 node.getClass().getMethod("getAttribute", String.class).invoke(node, attribute);
66 } catch (Exception e) {
67 throw new RuntimeException("Error invoking Xpp3Dom.getAttribute", e);
68 }
69 }
70 }