View Javadoc

1   /*
2    * @(#)$Id: JdomConfigurationParameter.java 689 2009-07-22 00:10:27Z bsigner $
3    *
4    * Author       :   Ueli Kurmann, igesture@uelikurmann.ch
5    *
6    * Purpose      : 	XML support for ConfigurationParameter class.
7    *
8    * -----------------------------------------------------------------------
9    *
10   * Revision Information:
11   *
12   * Date             Who         Reason
13   *
14   * Dec 26, 2006     ukurmann    Initial Release
15   * Mar 22, 2007     bsigner     Cleanup
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.configuration.jdom;
28  
29  import org.jdom.Element;
30  
31  
32  /**
33   * XML support for ConfigurationParameter class.
34   * 
35   * @version 1.0 Dec 2006
36   * @author Ueli Kurmann, igesture@uelikurmann.ch
37   * @author Beat Signer, signer@inf.ethz.ch
38   */
39  public class JdomConfigurationParameter extends Element {
40  
41     public static final String ROOT_TAG = "parameter";
42  
43     public static final String NAME_ATTRIBUTE = "name";
44  
45  
46     public JdomConfigurationParameter(String name, String value) {
47        super(ROOT_TAG);
48        this.setAttribute(NAME_ATTRIBUTE, name);
49        this.setText(value);
50     }
51  
52  
53     public static String[] unmarshal(Element parameter) {
54        final String[] result = new String[2];
55        result[0] = parameter.getAttribute(NAME_ATTRIBUTE).getValue();
56        result[1] = parameter.getText();
57        return result;
58     } // unmarshal
59  
60  }