View Javadoc

1   /*
2    * This class was automatically generated with 
3    * <a href="http://www.castor.org">Castor 0.9.7</a>, using an XML
4    * Schema.
5    * $Id$
6    */
7   
8   package fr.in2p3.jsaga.generated.session;
9   
10    //---------------------------------/
11   //- Imported classes and packages -/
12  //---------------------------------/
13  
14  import java.io.IOException;
15  import java.io.Reader;
16  import java.io.Serializable;
17  import java.io.Writer;
18  import java.util.ArrayList;
19  import java.util.Enumeration;
20  import org.exolab.castor.xml.MarshalException;
21  import org.exolab.castor.xml.Marshaller;
22  import org.exolab.castor.xml.Unmarshaller;
23  import org.exolab.castor.xml.ValidationException;
24  import org.xml.sax.ContentHandler;
25  
26  /**
27   * Class Attribute.
28   * 
29   * @version $Revision$ $Date$
30   */
31  public class Attribute implements java.io.Serializable {
32  
33  
34        //--------------------------/
35       //- Class/Member Variables -/
36      //--------------------------/
37  
38      /**
39       * Field _name
40       */
41      private java.lang.String _name;
42  
43      /**
44       * Field _value
45       */
46      private java.lang.String _value;
47  
48      /**
49       * Field _itemList
50       */
51      private java.util.ArrayList _itemList;
52  
53  
54        //----------------/
55       //- Constructors -/
56      //----------------/
57  
58      public Attribute() 
59       {
60          super();
61          _itemList = new ArrayList();
62      } //-- fr.in2p3.jsaga.generated.session.Attribute()
63  
64  
65        //-----------/
66       //- Methods -/
67      //-----------/
68  
69      /**
70       * Method addItem
71       * 
72       * 
73       * 
74       * @param vItem
75       */
76      public void addItem(java.lang.String vItem)
77          throws java.lang.IndexOutOfBoundsException
78      {
79          _itemList.add(vItem);
80      } //-- void addItem(java.lang.String) 
81  
82      /**
83       * Method addItem
84       * 
85       * 
86       * 
87       * @param index
88       * @param vItem
89       */
90      public void addItem(int index, java.lang.String vItem)
91          throws java.lang.IndexOutOfBoundsException
92      {
93          _itemList.add(index, vItem);
94      } //-- void addItem(int, java.lang.String) 
95  
96      /**
97       * Method clearItem
98       * 
99       */
100     public void clearItem()
101     {
102         _itemList.clear();
103     } //-- void clearItem() 
104 
105     /**
106      * Method enumerateItem
107      * 
108      * 
109      * 
110      * @return Enumeration
111      */
112     public java.util.Enumeration enumerateItem()
113     {
114         return new org.exolab.castor.util.IteratorEnumeration(_itemList.iterator());
115     } //-- java.util.Enumeration enumerateItem() 
116 
117     /**
118      * Method getItem
119      * 
120      * 
121      * 
122      * @param index
123      * @return String
124      */
125     public java.lang.String getItem(int index)
126         throws java.lang.IndexOutOfBoundsException
127     {
128         //-- check bounds for index
129         if ((index < 0) || (index > _itemList.size())) {
130             throw new IndexOutOfBoundsException();
131         }
132         
133         return (String)_itemList.get(index);
134     } //-- java.lang.String getItem(int) 
135 
136     /**
137      * Method getItem
138      * 
139      * 
140      * 
141      * @return String
142      */
143     public java.lang.String[] getItem()
144     {
145         int size = _itemList.size();
146         java.lang.String[] mArray = new java.lang.String[size];
147         for (int index = 0; index < size; index++) {
148             mArray[index] = (String)_itemList.get(index);
149         }
150         return mArray;
151     } //-- java.lang.String[] getItem() 
152 
153     /**
154      * Method getItemCount
155      * 
156      * 
157      * 
158      * @return int
159      */
160     public int getItemCount()
161     {
162         return _itemList.size();
163     } //-- int getItemCount() 
164 
165     /**
166      * Returns the value of field 'name'.
167      * 
168      * @return String
169      * @return the value of field 'name'.
170      */
171     public java.lang.String getName()
172     {
173         return this._name;
174     } //-- java.lang.String getName() 
175 
176     /**
177      * Returns the value of field 'value'.
178      * 
179      * @return String
180      * @return the value of field 'value'.
181      */
182     public java.lang.String getValue()
183     {
184         return this._value;
185     } //-- java.lang.String getValue() 
186 
187     /**
188      * Method isValid
189      * 
190      * 
191      * 
192      * @return boolean
193      */
194     public boolean isValid()
195     {
196         try {
197             validate();
198         }
199         catch (org.exolab.castor.xml.ValidationException vex) {
200             return false;
201         }
202         return true;
203     } //-- boolean isValid() 
204 
205     /**
206      * Method marshal
207      * 
208      * 
209      * 
210      * @param out
211      */
212     public void marshal(java.io.Writer out)
213         throws org.exolab.castor.xml.MarshalException, org.exolab.castor.xml.ValidationException
214     {
215         
216         Marshaller.marshal(this, out);
217     } //-- void marshal(java.io.Writer) 
218 
219     /**
220      * Method marshal
221      * 
222      * 
223      * 
224      * @param handler
225      */
226     public void marshal(org.xml.sax.ContentHandler handler)
227         throws java.io.IOException, org.exolab.castor.xml.MarshalException, org.exolab.castor.xml.ValidationException
228     {
229         
230         Marshaller.marshal(this, handler);
231     } //-- void marshal(org.xml.sax.ContentHandler) 
232 
233     /**
234      * Method removeItem
235      * 
236      * 
237      * 
238      * @param vItem
239      * @return boolean
240      */
241     public boolean removeItem(java.lang.String vItem)
242     {
243         boolean removed = _itemList.remove(vItem);
244         return removed;
245     } //-- boolean removeItem(java.lang.String) 
246 
247     /**
248      * Method setItem
249      * 
250      * 
251      * 
252      * @param index
253      * @param vItem
254      */
255     public void setItem(int index, java.lang.String vItem)
256         throws java.lang.IndexOutOfBoundsException
257     {
258         //-- check bounds for index
259         if ((index < 0) || (index > _itemList.size())) {
260             throw new IndexOutOfBoundsException();
261         }
262         _itemList.set(index, vItem);
263     } //-- void setItem(int, java.lang.String) 
264 
265     /**
266      * Method setItem
267      * 
268      * 
269      * 
270      * @param itemArray
271      */
272     public void setItem(java.lang.String[] itemArray)
273     {
274         //-- copy array
275         _itemList.clear();
276         for (int i = 0; i < itemArray.length; i++) {
277             _itemList.add(itemArray[i]);
278         }
279     } //-- void setItem(java.lang.String) 
280 
281     /**
282      * Sets the value of field 'name'.
283      * 
284      * @param name the value of field 'name'.
285      */
286     public void setName(java.lang.String name)
287     {
288         this._name = name;
289     } //-- void setName(java.lang.String) 
290 
291     /**
292      * Sets the value of field 'value'.
293      * 
294      * @param value the value of field 'value'.
295      */
296     public void setValue(java.lang.String value)
297     {
298         this._value = value;
299     } //-- void setValue(java.lang.String) 
300 
301     /**
302      * Method unmarshal
303      * 
304      * 
305      * 
306      * @param reader
307      * @return Object
308      */
309     public static java.lang.Object unmarshal(java.io.Reader reader)
310         throws org.exolab.castor.xml.MarshalException, org.exolab.castor.xml.ValidationException
311     {
312         return (fr.in2p3.jsaga.generated.session.Attribute) Unmarshaller.unmarshal(fr.in2p3.jsaga.generated.session.Attribute.class, reader);
313     } //-- java.lang.Object unmarshal(java.io.Reader) 
314 
315     /**
316      * Method validate
317      * 
318      */
319     public void validate()
320         throws org.exolab.castor.xml.ValidationException
321     {
322         org.exolab.castor.xml.Validator validator = new org.exolab.castor.xml.Validator();
323         validator.validate(this);
324     } //-- void validate() 
325 
326 }