1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27 package org.ximtec.igesture.batch.core.jdom;
28
29 import java.util.List;
30
31 import org.jdom.Element;
32 import org.ximtec.igesture.batch.core.BatchAlgorithm;
33
34
35
36
37
38
39
40
41 public class JdomBatchAlgorithm {
42
43 public static String ROOT_TAG = "algorithm";
44
45 public static String ATTRIBUTE_NAME = "name";
46
47
48 @SuppressWarnings("unchecked")
49 public static BatchAlgorithm unmarshal(Element algorithm) {
50 final BatchAlgorithm batchAlgorithm = new BatchAlgorithm();
51 batchAlgorithm.setName(algorithm
52 .getAttributeValue(ATTRIBUTE_NAME));
53
54 final List<Element> parameterElements = algorithm
55 .getChildren(JdomBatchParameter.ROOT_TAG);
56
57 for (final Element elem : parameterElements) {
58 batchAlgorithm.addParameter(JdomBatchParameter.unmarshal(elem));
59 }
60
61 return batchAlgorithm;
62 }
63
64 }