View Javadoc

1   /*
2    * @(#)$Id: JdomBatchParameter.java 689 2009-07-22 00:10:27Z bsigner $
3    *
4    * Author		:	Ueli Kurmann, igesture@uelikurmann.ch
5    *                  
6    *
7    * Purpose		: 
8    *
9    * -----------------------------------------------------------------------
10   *
11   * Revision Information:
12   *
13   * Date				Who			Reason
14   *
15   * 15.10.2008		ukurmann	Initial Release
16   *
17   * -----------------------------------------------------------------------
18   *
19   * Copyright 1999-2009 ETH Zurich. All Rights Reserved.
20   *
21   * This software is the proprietary information of ETH Zurich.
22   * Use is subject to license terms.
23   * 
24   */
25  
26  
27  package org.ximtec.igesture.batch.core.jdom;
28  
29  import org.jdom.Element;
30  import org.ximtec.igesture.batch.core.BatchParameter;
31  
32  
33  
34  
35  /**
36   * Comment
37   * @version 1.0 15.10.2008
38   * @author Ueli Kurmann
39   */
40  public class JdomBatchParameter {
41  
42     public static String ROOT_TAG = "parameter";
43  
44     public static String ATTRIBUTE_NAME = "name";
45  
46     
47     public static BatchParameter unmarshal(Element parameter) {
48        final BatchParameter batchParameter = new BatchParameter();
49        batchParameter.setName(parameter.getAttributeValue(ATTRIBUTE_NAME));
50        final Element parameterValue = ((Element)parameter.getChildren().get(0));
51  
52        if (parameterValue.getName().equals(JdomBatchForValue.ROOT_TAG)) {
53           batchParameter.setIncrementalValue(JdomBatchForValue
54                 .unmarshal(parameterValue));
55        }
56        else if (parameterValue.getName().equals(JdomBatchPowerSetValue.ROOT_TAG)) {
57           batchParameter.setPermutationValue(JdomBatchPowerSetValue
58                 .unmarshal(parameterValue));
59        }
60        else if (parameterValue.getName().equals(JdomBatchSequenceValue.ROOT_TAG)) {
61           batchParameter.setSequenceValue(JdomBatchSequenceValue
62                 .unmarshal(parameterValue));
63        }
64        else if (parameterValue.getName().equals(JdomBatchValue.ROOT_TAG)) {
65           batchParameter.setValue(JdomBatchValue.unmarshal(parameterValue));
66        }
67  
68        return batchParameter;
69     } // unmarshal
70  
71  }