rebult for castor-1.1(vamsas version)
[vamsas.git] / src / uk / ac / vamsas / objects / core / AppData.java
1 /*\r
2  * This class was automatically generated with \r
3  * <a href="http://www.castor.org">Castor 1.1</a>, using an XML\r
4  * Schema.\r
5  * $Id$\r
6  */\r
7 \r
8 package uk.ac.vamsas.objects.core;\r
9 \r
10   //---------------------------------/\r
11  //- Imported classes and packages -/\r
12 //---------------------------------/\r
13 \r
14 import org.exolab.castor.xml.Marshaller;\r
15 import org.exolab.castor.xml.Unmarshaller;\r
16 \r
17 /**\r
18  * Class AppData.\r
19  * \r
20  * @version $Revision$ $Date$\r
21  */\r
22 public class AppData extends uk.ac.vamsas.client.Vobject \r
23 implements java.io.Serializable\r
24 {\r
25 \r
26 \r
27       //--------------------------/\r
28      //- Class/Member Variables -/\r
29     //--------------------------/\r
30 \r
31     /**\r
32      * Internal choice value storage\r
33      */\r
34     private java.lang.Object _choiceValue;\r
35 \r
36     /**\r
37      * Field _data.\r
38      */\r
39     private byte[] _data;\r
40 \r
41     /**\r
42      * Field _dataReference.\r
43      */\r
44     private java.lang.String _dataReference;\r
45 \r
46 \r
47       //----------------/\r
48      //- Constructors -/\r
49     //----------------/\r
50 \r
51     public AppData() {\r
52         super();\r
53     }\r
54 \r
55 \r
56       //-----------/\r
57      //- Methods -/\r
58     //-----------/\r
59 \r
60     /**\r
61      * Overrides the java.lang.Object.equals method.\r
62      * \r
63      * @param obj\r
64      * @return true if the objects are equal.\r
65      */\r
66     public boolean equals(\r
67             final java.lang.Object obj) {\r
68         if ( this == obj )\r
69             return true;\r
70         \r
71         if (super.equals(obj)==false)\r
72             return false;\r
73         \r
74         if (obj instanceof AppData) {\r
75         \r
76             AppData temp = (AppData)obj;\r
77             if (this._choiceValue != null) {\r
78                 if (temp._choiceValue == null) return false;\r
79                 else if (!(this._choiceValue.equals(temp._choiceValue))) \r
80                     return false;\r
81             }\r
82             else if (temp._choiceValue != null)\r
83                 return false;\r
84             if (this._data != null) {\r
85                 if (temp._data == null) return false;\r
86                 else if (!(java.util.Arrays.equals(this._data, temp._data))) \r
87                     return false;\r
88             }\r
89             else if (temp._data != null)\r
90                 return false;\r
91             if (this._dataReference != null) {\r
92                 if (temp._dataReference == null) return false;\r
93                 else if (!(this._dataReference.equals(temp._dataReference))) \r
94                     return false;\r
95             }\r
96             else if (temp._dataReference != null)\r
97                 return false;\r
98             return true;\r
99         }\r
100         return false;\r
101     }\r
102 \r
103     /**\r
104      * Returns the value of field 'choiceValue'. The field\r
105      * 'choiceValue' has the following description: Internal choice\r
106      * value storage\r
107      * \r
108      * @return the value of field 'ChoiceValue'.\r
109      */\r
110     public java.lang.Object getChoiceValue(\r
111     ) {\r
112         return this._choiceValue;\r
113     }\r
114 \r
115     /**\r
116      * Returns the value of field 'data'.\r
117      * \r
118      * @return the value of field 'Data'.\r
119      */\r
120     public byte[] getData(\r
121     ) {\r
122         return this._data;\r
123     }\r
124 \r
125     /**\r
126      * Returns the value of field 'dataReference'.\r
127      * \r
128      * @return the value of field 'DataReference'.\r
129      */\r
130     public java.lang.String getDataReference(\r
131     ) {\r
132         return this._dataReference;\r
133     }\r
134 \r
135     /**\r
136      * Overrides the java.lang.Object.hashCode method.\r
137      * <p>\r
138      * The following steps came from <b>Effective Java Programming\r
139      * Language Guide</b> by Joshua Bloch, Chapter 3\r
140      * \r
141      * @return a hash code value for the object.\r
142      */\r
143     public int hashCode(\r
144     ) {\r
145         int result = super.hashCode();\r
146         \r
147         long tmp;\r
148         if (_choiceValue != null) {\r
149            result = 37 * result + _choiceValue.hashCode();\r
150         }\r
151         if (_data != null) {\r
152            result = 37 * result + _data.hashCode();\r
153         }\r
154         if (_dataReference != null) {\r
155            result = 37 * result + _dataReference.hashCode();\r
156         }\r
157         \r
158         return result;\r
159     }\r
160 \r
161     /**\r
162      * Method isValid.\r
163      * \r
164      * @return true if this object is valid according to the schema\r
165      */\r
166     public boolean isValid(\r
167     ) {\r
168         try {\r
169             validate();\r
170         } catch (org.exolab.castor.xml.ValidationException vex) {\r
171             return false;\r
172         }\r
173         return true;\r
174     }\r
175 \r
176     /**\r
177      * \r
178      * \r
179      * @param out\r
180      * @throws org.exolab.castor.xml.MarshalException if object is\r
181      * null or if any SAXException is thrown during marshaling\r
182      * @throws org.exolab.castor.xml.ValidationException if this\r
183      * object is an invalid instance according to the schema\r
184      */\r
185     public void marshal(\r
186             final java.io.Writer out)\r
187     throws org.exolab.castor.xml.MarshalException, org.exolab.castor.xml.ValidationException {\r
188         Marshaller.marshal(this, out);\r
189     }\r
190 \r
191     /**\r
192      * \r
193      * \r
194      * @param handler\r
195      * @throws java.io.IOException if an IOException occurs during\r
196      * marshaling\r
197      * @throws org.exolab.castor.xml.ValidationException if this\r
198      * object is an invalid instance according to the schema\r
199      * @throws org.exolab.castor.xml.MarshalException if object is\r
200      * null or if any SAXException is thrown during marshaling\r
201      */\r
202     public void marshal(\r
203             final org.xml.sax.ContentHandler handler)\r
204     throws java.io.IOException, org.exolab.castor.xml.MarshalException, org.exolab.castor.xml.ValidationException {\r
205         Marshaller.marshal(this, handler);\r
206     }\r
207 \r
208     /**\r
209      * Sets the value of field 'data'.\r
210      * \r
211      * @param data the value of field 'data'.\r
212      */\r
213     public void setData(\r
214             final byte[] data) {\r
215         this._data = data;\r
216         this._choiceValue = data;\r
217     }\r
218 \r
219     /**\r
220      * Sets the value of field 'dataReference'.\r
221      * \r
222      * @param dataReference the value of field 'dataReference'.\r
223      */\r
224     public void setDataReference(\r
225             final java.lang.String dataReference) {\r
226         this._dataReference = dataReference;\r
227         this._choiceValue = dataReference;\r
228     }\r
229 \r
230     /**\r
231      * Method unmarshal.\r
232      * \r
233      * @param reader\r
234      * @throws org.exolab.castor.xml.MarshalException if object is\r
235      * null or if any SAXException is thrown during marshaling\r
236      * @throws org.exolab.castor.xml.ValidationException if this\r
237      * object is an invalid instance according to the schema\r
238      * @return the unmarshaled uk.ac.vamsas.objects.core.AppData\r
239      */\r
240     public static uk.ac.vamsas.objects.core.AppData unmarshal(\r
241             final java.io.Reader reader)\r
242     throws org.exolab.castor.xml.MarshalException, org.exolab.castor.xml.ValidationException {\r
243         return (uk.ac.vamsas.objects.core.AppData) Unmarshaller.unmarshal(uk.ac.vamsas.objects.core.AppData.class, reader);\r
244     }\r
245 \r
246     /**\r
247      * \r
248      * \r
249      * @throws org.exolab.castor.xml.ValidationException if this\r
250      * object is an invalid instance according to the schema\r
251      */\r
252     public void validate(\r
253     )\r
254     throws org.exolab.castor.xml.ValidationException {\r
255         org.exolab.castor.xml.Validator validator = new org.exolab.castor.xml.Validator();\r
256         validator.validate(this);\r
257     }\r
258 \r
259 }\r