View Javadoc

1   /*
2    * This class was automatically generated with 
3    * <a href="http://www.castor.org">Castor 0.9.4.3</a>, using an XML
4    * Schema.
5    * $Id: AnyTEXT.java,v 1.14 2007/01/04 16:26:13 clq2 Exp $
6    */
7   
8   package org.astrogrid.registry.beans.resource.votable;
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 AnyTEXT.
28   * 
29   * @version $Revision: 1.14 $ $Date: 2007/01/04 16:26:13 $
30   */
31  public class AnyTEXT extends org.astrogrid.common.bean.BaseBean 
32  implements java.io.Serializable
33  {
34  
35  
36        //--------------------------/
37       //- Class/Member Variables -/
38      //--------------------------/
39  
40      /***
41       * internal content storage
42       */
43      private java.lang.String _content = "";
44  
45      /***
46       * Field _anyObject
47       */
48      private java.util.ArrayList _anyObject;
49  
50  
51        //----------------/
52       //- Constructors -/
53      //----------------/
54  
55      public AnyTEXT() {
56          super();
57          setContent("");
58          _anyObject = new ArrayList();
59      } //-- org.astrogrid.registry.beans.resource.votable.AnyTEXT()
60  
61  
62        //-----------/
63       //- Methods -/
64      //-----------/
65  
66      /***
67       * Method addAnyObject
68       * 
69       * @param vAnyObject
70       */
71      public void addAnyObject(java.lang.Object vAnyObject)
72          throws java.lang.IndexOutOfBoundsException
73      {
74          _anyObject.add(vAnyObject);
75      } //-- void addAnyObject(java.lang.Object) 
76  
77      /***
78       * Method addAnyObject
79       * 
80       * @param index
81       * @param vAnyObject
82       */
83      public void addAnyObject(int index, java.lang.Object vAnyObject)
84          throws java.lang.IndexOutOfBoundsException
85      {
86          _anyObject.add(index, vAnyObject);
87      } //-- void addAnyObject(int, java.lang.Object) 
88  
89      /***
90       * Method clearAnyObject
91       */
92      public void clearAnyObject()
93      {
94          _anyObject.clear();
95      } //-- void clearAnyObject() 
96  
97      /***
98       * Method enumerateAnyObject
99       */
100     public java.util.Enumeration enumerateAnyObject()
101     {
102         return new org.exolab.castor.util.IteratorEnumeration(_anyObject.iterator());
103     } //-- java.util.Enumeration enumerateAnyObject() 
104 
105     /***
106      * Note: hashCode() has not been overriden
107      * 
108      * @param obj
109      */
110     public boolean equals(java.lang.Object obj)
111     {
112         if ( this == obj )
113             return true;
114         
115         if (super.equals(obj)==false)
116             return false;
117         
118         if (obj instanceof AnyTEXT) {
119         
120             AnyTEXT temp = (AnyTEXT)obj;
121             if (this._content != null) {
122                 if (temp._content == null) return false;
123                 else if (!(this._content.equals(temp._content))) 
124                     return false;
125             }
126             else if (temp._content != null)
127                 return false;
128             if (this._anyObject != null) {
129                 if (temp._anyObject == null) return false;
130                 else if (!(this._anyObject.equals(temp._anyObject))) 
131                     return false;
132             }
133             else if (temp._anyObject != null)
134                 return false;
135             return true;
136         }
137         return false;
138     } //-- boolean equals(java.lang.Object) 
139 
140     /***
141      * Method getAnyObject
142      * 
143      * @param index
144      */
145     public java.lang.Object getAnyObject(int index)
146         throws java.lang.IndexOutOfBoundsException
147     {
148         //-- check bounds for index
149         if ((index < 0) || (index > _anyObject.size())) {
150             throw new IndexOutOfBoundsException();
151         }
152         
153         return (java.lang.Object) _anyObject.get(index);
154     } //-- java.lang.Object getAnyObject(int) 
155 
156     /***
157      * Method getAnyObject
158      */
159     public java.lang.Object[] getAnyObject()
160     {
161         int size = _anyObject.size();
162         java.lang.Object[] mArray = new java.lang.Object[size];
163         for (int index = 0; index < size; index++) {
164             mArray[index] = (java.lang.Object) _anyObject.get(index);
165         }
166         return mArray;
167     } //-- java.lang.Object[] getAnyObject() 
168 
169     /***
170      * Method getAnyObjectCount
171      */
172     public int getAnyObjectCount()
173     {
174         return _anyObject.size();
175     } //-- int getAnyObjectCount() 
176 
177     /***
178      * Returns the value of field 'content'. The field 'content'
179      * has the following description: internal content storage
180      * 
181      * @return the value of field 'content'.
182      */
183     public java.lang.String getContent()
184     {
185         return this._content;
186     } //-- java.lang.String getContent() 
187 
188     /***
189      * Method isValid
190      */
191     public boolean isValid()
192     {
193         try {
194             validate();
195         }
196         catch (org.exolab.castor.xml.ValidationException vex) {
197             return false;
198         }
199         return true;
200     } //-- boolean isValid() 
201 
202     /***
203      * Method marshal
204      * 
205      * @param out
206      */
207     public void marshal(java.io.Writer out)
208         throws org.exolab.castor.xml.MarshalException, org.exolab.castor.xml.ValidationException
209     {
210         
211         Marshaller.marshal(this, out);
212     } //-- void marshal(java.io.Writer) 
213 
214     /***
215      * Method marshal
216      * 
217      * @param handler
218      */
219     public void marshal(org.xml.sax.ContentHandler handler)
220         throws java.io.IOException, org.exolab.castor.xml.MarshalException, org.exolab.castor.xml.ValidationException
221     {
222         
223         Marshaller.marshal(this, handler);
224     } //-- void marshal(org.xml.sax.ContentHandler) 
225 
226     /***
227      * Method removeAnyObject
228      * 
229      * @param vAnyObject
230      */
231     public boolean removeAnyObject(java.lang.Object vAnyObject)
232     {
233         boolean removed = _anyObject.remove(vAnyObject);
234         return removed;
235     } //-- boolean removeAnyObject(java.lang.Object) 
236 
237     /***
238      * Method setAnyObject
239      * 
240      * @param index
241      * @param vAnyObject
242      */
243     public void setAnyObject(int index, java.lang.Object vAnyObject)
244         throws java.lang.IndexOutOfBoundsException
245     {
246         //-- check bounds for index
247         if ((index < 0) || (index > _anyObject.size())) {
248             throw new IndexOutOfBoundsException();
249         }
250         _anyObject.set(index, vAnyObject);
251     } //-- void setAnyObject(int, java.lang.Object) 
252 
253     /***
254      * Method setAnyObject
255      * 
256      * @param anyObjectArray
257      */
258     public void setAnyObject(java.lang.Object[] anyObjectArray)
259     {
260         //-- copy array
261         _anyObject.clear();
262         for (int i = 0; i < anyObjectArray.length; i++) {
263             _anyObject.add(anyObjectArray[i]);
264         }
265     } //-- void setAnyObject(java.lang.Object) 
266 
267     /***
268      * Sets the value of field 'content'. The field 'content' has
269      * the following description: internal content storage
270      * 
271      * @param content the value of field 'content'.
272      */
273     public void setContent(java.lang.String content)
274     {
275         this._content = content;
276     } //-- void setContent(java.lang.String) 
277 
278     /***
279      * Method unmarshalAnyTEXT
280      * 
281      * @param reader
282      */
283     public static org.astrogrid.registry.beans.resource.votable.AnyTEXT unmarshalAnyTEXT(java.io.Reader reader)
284         throws org.exolab.castor.xml.MarshalException, org.exolab.castor.xml.ValidationException
285     {
286         return (org.astrogrid.registry.beans.resource.votable.AnyTEXT) Unmarshaller.unmarshal(org.astrogrid.registry.beans.resource.votable.AnyTEXT.class, reader);
287     } //-- org.astrogrid.registry.beans.resource.votable.AnyTEXT unmarshalAnyTEXT(java.io.Reader) 
288 
289     /***
290      * Method validate
291      */
292     public void validate()
293         throws org.exolab.castor.xml.ValidationException
294     {
295         org.exolab.castor.xml.Validator validator = new org.exolab.castor.xml.Validator();
296         validator.validate(this);
297     } //-- void validate() 
298 
299 }