1 package sharin.doc.builder;
2
3 import java.util.ArrayList;
4 import java.util.List;
5
6 public class Elem {
7
8 private String name;
9
10 private final List<Attr> attrList = new ArrayList<Attr>();
11
12 private final List<Object> nodeList = new ArrayList<Object>();
13
14 public Elem(String name, Object... nodes) {
15 this.name = name;
16 _(nodes);
17 }
18
19 public Elem attr(String name, Object value) {
20 Attr attr = new Attr(name, value);
21 attrList.add(attr);
22 return this;
23 }
24
25 public Elem _(Object... nodes) {
26
27 for (Object node : nodes) {
28 nodeList.add(node);
29 }
30
31 return this;
32 }
33
34 public String getName() {
35 return name;
36 }
37
38 public void setName(String name) {
39 this.name = name;
40 }
41
42 public List<Attr> getAttrList() {
43 return attrList;
44 }
45
46 public List<Object> getNodeList() {
47 return nodeList;
48 }
49 }