CollectionDomSerializer.java
biz/hammurapi/xml/dom/CollectionDomSerializer.java
Violations
Inspector |
Message |
Severity |
Location |
Java Inspector 048 |
Copyrights information should be present in each file. |
1 |
|
Java Inspector 089 |
Type is not documented |
2 |
37:1
|
Java Inspector 089 |
Undocumented method |
2 |
39:9
|
Java Inspector 089 |
Undocumented method |
2 |
42:25
|
Java Inspector 026 |
Avoid hardwired string literals. Allowed literals: [] |
3 |
43:49
|
Java Inspector 026 |
Avoid hardwired string literals. Allowed literals: [] |
3 |
48:92
|
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23package biz.hammurapi.xml.dom;
24
25import java.util.Collection;
26import java.util.Iterator;
27
28import org.w3c.dom.Element;
29
30import biz.hammurapi.convert.Converter;
31
32
33
34
35
36
37public class CollectionDomSerializer {
38
39 public DomSerializable convert(final Collection col, final Converter master) {
40 return new DomSerializable() {
41
42 public void toDom(Element holder) {
43 holder.setAttribute("type", col.getClass().getName());
44 Iterator it=col.iterator();
45 while (it.hasNext()) {
46 DomSerializable ds=(DomSerializable) master.convert(it.next(), DomSerializable.class, null);
47 if (ds!=null) {
48 Element el=holder.getOwnerDocument().createElement("element");
49 holder.appendChild(el);
50 ds.toDom(el);
51 }
52 }
53 }
54
55 };
56 }
57}
58