KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > sapia > util > xml > confix > test > Config


1 package org.sapia.util.xml.confix.test;
2
3 // Import of Sun's JDK classes
4
// ---------------------------
5
import java.util.ArrayList JavaDoc;
6 import java.util.List JavaDoc;
7
8 import org.sapia.util.xml.confix.ObjectHandlerIF;
9
10 /**
11  *
12  *
13  * @author Jean-Cedric Desrochers
14  *
15  * <dl>
16  * <dt><b>Copyright:</b><dd>Copyright &#169; 2002-2003 <a HREF="http://www.sapia-oss.org">Sapia Open Source Software</a>. All Rights Reserved.</dd></dt>
17  * <dt><b>License:</b><dd>Read the license.txt file of the jar or visit the
18  * <a HREF="http://www.sapia-oss.org/license.html">license page</a> at the Sapia OSS web site</dd></dt>
19  * </dl>
20  */

21 public class Config implements ObjectHandlerIF {
22
23   private String JavaDoc _theName;
24   private ArrayList JavaDoc _theNamedValues;
25   private Object JavaDoc[] _theCustomObject;
26
27   public Config() {
28     _theNamedValues = new ArrayList JavaDoc();
29     _theCustomObject = new Object JavaDoc[2];
30   }
31
32   public String JavaDoc getName() {
33     return _theName;
34   }
35
36   public List JavaDoc getNamedValues() {
37     return _theNamedValues;
38   }
39
40   public void setName(String JavaDoc aName) {
41     _theName = aName;
42   }
43
44   public void addWrappedNamedValue(WrappedNamedValue aWrapper) {
45     _theNamedValues.add(aWrapper.getNamedValue());
46   }
47
48   public void addNamedValue(NamedValue aNamedValue) {
49     _theNamedValues.add(aNamedValue);
50   }
51
52   public NamedValue createParam() {
53     NamedValue aNamedValue = new NamedValue();
54     _theNamedValues.add(aNamedValue);
55     return aNamedValue;
56   }
57
58   public void setParam(NamedValue aNamedValue) {
59     _theNamedValues.add(aNamedValue);
60   }
61
62   public Object JavaDoc[] getCustomObject() {
63     return _theCustomObject;
64   }
65
66   /**
67    * Handles the passed in object that was created for the element name passed in.
68    *
69    * @param anElementName The xml element name for which the object was created.
70    * @param anObject The object to handle.
71    */

72   public void handleObject(String JavaDoc anElementName, Object JavaDoc anObject) {
73     _theCustomObject[0] = anElementName;
74     _theCustomObject[1] = anObject;
75   }
76 }
77
Popular Tags