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.adaptor.schema.data.catalog;
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 Metadata.
28   * 
29   * @version $Revision$ $Date$
30   */
31  public class Metadata 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 _valueList
45       */
46      private java.util.ArrayList _valueList;
47  
48  
49        //----------------/
50       //- Constructors -/
51      //----------------/
52  
53      public Metadata() 
54       {
55          super();
56          _valueList = new ArrayList();
57      } //-- fr.in2p3.jsaga.adaptor.schema.data.catalog.Metadata()
58  
59  
60        //-----------/
61       //- Methods -/
62      //-----------/
63  
64      /**
65       * Method addValue
66       * 
67       * 
68       * 
69       * @param vValue
70       */
71      public void addValue(java.lang.String vValue)
72          throws java.lang.IndexOutOfBoundsException
73      {
74          _valueList.add(vValue);
75      } //-- void addValue(java.lang.String) 
76  
77      /**
78       * Method addValue
79       * 
80       * 
81       * 
82       * @param index
83       * @param vValue
84       */
85      public void addValue(int index, java.lang.String vValue)
86          throws java.lang.IndexOutOfBoundsException
87      {
88          _valueList.add(index, vValue);
89      } //-- void addValue(int, java.lang.String) 
90  
91      /**
92       * Method clearValue
93       * 
94       */
95      public void clearValue()
96      {
97          _valueList.clear();
98      } //-- void clearValue() 
99  
100     /**
101      * Method enumerateValue
102      * 
103      * 
104      * 
105      * @return Enumeration
106      */
107     public java.util.Enumeration enumerateValue()
108     {
109         return new org.exolab.castor.util.IteratorEnumeration(_valueList.iterator());
110     } //-- java.util.Enumeration enumerateValue() 
111 
112     /**
113      * Returns the value of field 'name'.
114      * 
115      * @return String
116      * @return the value of field 'name'.
117      */
118     public java.lang.String getName()
119     {
120         return this._name;
121     } //-- java.lang.String getName() 
122 
123     /**
124      * Method getValue
125      * 
126      * 
127      * 
128      * @param index
129      * @return String
130      */
131     public java.lang.String getValue(int index)
132         throws java.lang.IndexOutOfBoundsException
133     {
134         //-- check bounds for index
135         if ((index < 0) || (index > _valueList.size())) {
136             throw new IndexOutOfBoundsException();
137         }
138         
139         return (String)_valueList.get(index);
140     } //-- java.lang.String getValue(int) 
141 
142     /**
143      * Method getValue
144      * 
145      * 
146      * 
147      * @return String
148      */
149     public java.lang.String[] getValue()
150     {
151         int size = _valueList.size();
152         java.lang.String[] mArray = new java.lang.String[size];
153         for (int index = 0; index < size; index++) {
154             mArray[index] = (String)_valueList.get(index);
155         }
156         return mArray;
157     } //-- java.lang.String[] getValue() 
158 
159     /**
160      * Method getValueCount
161      * 
162      * 
163      * 
164      * @return int
165      */
166     public int getValueCount()
167     {
168         return _valueList.size();
169     } //-- int getValueCount() 
170 
171     /**
172      * Method isValid
173      * 
174      * 
175      * 
176      * @return boolean
177      */
178     public boolean isValid()
179     {
180         try {
181             validate();
182         }
183         catch (org.exolab.castor.xml.ValidationException vex) {
184             return false;
185         }
186         return true;
187     } //-- boolean isValid() 
188 
189     /**
190      * Method marshal
191      * 
192      * 
193      * 
194      * @param out
195      */
196     public void marshal(java.io.Writer out)
197         throws org.exolab.castor.xml.MarshalException, org.exolab.castor.xml.ValidationException
198     {
199         
200         Marshaller.marshal(this, out);
201     } //-- void marshal(java.io.Writer) 
202 
203     /**
204      * Method marshal
205      * 
206      * 
207      * 
208      * @param handler
209      */
210     public void marshal(org.xml.sax.ContentHandler handler)
211         throws java.io.IOException, org.exolab.castor.xml.MarshalException, org.exolab.castor.xml.ValidationException
212     {
213         
214         Marshaller.marshal(this, handler);
215     } //-- void marshal(org.xml.sax.ContentHandler) 
216 
217     /**
218      * Method removeValue
219      * 
220      * 
221      * 
222      * @param vValue
223      * @return boolean
224      */
225     public boolean removeValue(java.lang.String vValue)
226     {
227         boolean removed = _valueList.remove(vValue);
228         return removed;
229     } //-- boolean removeValue(java.lang.String) 
230 
231     /**
232      * Sets the value of field 'name'.
233      * 
234      * @param name the value of field 'name'.
235      */
236     public void setName(java.lang.String name)
237     {
238         this._name = name;
239     } //-- void setName(java.lang.String) 
240 
241     /**
242      * Method setValue
243      * 
244      * 
245      * 
246      * @param index
247      * @param vValue
248      */
249     public void setValue(int index, java.lang.String vValue)
250         throws java.lang.IndexOutOfBoundsException
251     {
252         //-- check bounds for index
253         if ((index < 0) || (index > _valueList.size())) {
254             throw new IndexOutOfBoundsException();
255         }
256         _valueList.set(index, vValue);
257     } //-- void setValue(int, java.lang.String) 
258 
259     /**
260      * Method setValue
261      * 
262      * 
263      * 
264      * @param valueArray
265      */
266     public void setValue(java.lang.String[] valueArray)
267     {
268         //-- copy array
269         _valueList.clear();
270         for (int i = 0; i < valueArray.length; i++) {
271             _valueList.add(valueArray[i]);
272         }
273     } //-- void setValue(java.lang.String) 
274 
275     /**
276      * Method unmarshal
277      * 
278      * 
279      * 
280      * @param reader
281      * @return Object
282      */
283     public static java.lang.Object unmarshal(java.io.Reader reader)
284         throws org.exolab.castor.xml.MarshalException, org.exolab.castor.xml.ValidationException
285     {
286         return (fr.in2p3.jsaga.adaptor.schema.data.catalog.Metadata) Unmarshaller.unmarshal(fr.in2p3.jsaga.adaptor.schema.data.catalog.Metadata.class, reader);
287     } //-- java.lang.Object unmarshal(java.io.Reader) 
288 
289     /**
290      * Method validate
291      * 
292      */
293     public void validate()
294         throws org.exolab.castor.xml.ValidationException
295     {
296         org.exolab.castor.xml.Validator validator = new org.exolab.castor.xml.Validator();
297         validator.validate(this);
298     } //-- void validate() 
299 
300 }