rebult for castor-1.1(vamsas version)
[vamsas.git] / src / uk / ac / vamsas / objects / core / Property.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 Property.\r
19  * \r
20  * @version $Revision$ $Date$\r
21  */\r
22 public class Property 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 content storage\r
33      */\r
34     private java.lang.String _content = "";\r
35 \r
36     /**\r
37      * Field _name.\r
38      */\r
39     private java.lang.String _name;\r
40 \r
41     /**\r
42      * The type specifies how the property will be parsed.\r
43      *  Empty property strings are allowed, and can be used to\r
44      * prototype the\r
45      *  input to a document. TODO: specify allowed types \r
46      */\r
47     private java.lang.String _type;\r
48 \r
49 \r
50       //----------------/\r
51      //- Constructors -/\r
52     //----------------/\r
53 \r
54     public Property() {\r
55         super();\r
56         setContent("");\r
57     }\r
58 \r
59 \r
60       //-----------/\r
61      //- Methods -/\r
62     //-----------/\r
63 \r
64     /**\r
65      * Overrides the java.lang.Object.equals method.\r
66      * \r
67      * @param obj\r
68      * @return true if the objects are equal.\r
69      */\r
70     public boolean equals(\r
71             final java.lang.Object obj) {\r
72         if ( this == obj )\r
73             return true;\r
74         \r
75         if (super.equals(obj)==false)\r
76             return false;\r
77         \r
78         if (obj instanceof Property) {\r
79         \r
80             Property temp = (Property)obj;\r
81             if (this._content != null) {\r
82                 if (temp._content == null) return false;\r
83                 else if (!(this._content.equals(temp._content))) \r
84                     return false;\r
85             }\r
86             else if (temp._content != null)\r
87                 return false;\r
88             if (this._name != null) {\r
89                 if (temp._name == null) return false;\r
90                 else if (!(this._name.equals(temp._name))) \r
91                     return false;\r
92             }\r
93             else if (temp._name != null)\r
94                 return false;\r
95             if (this._type != null) {\r
96                 if (temp._type == null) return false;\r
97                 else if (!(this._type.equals(temp._type))) \r
98                     return false;\r
99             }\r
100             else if (temp._type != null)\r
101                 return false;\r
102             return true;\r
103         }\r
104         return false;\r
105     }\r
106 \r
107     /**\r
108      * Returns the value of field 'content'. The field 'content'\r
109      * has the following description: internal content storage\r
110      * \r
111      * @return the value of field 'Content'.\r
112      */\r
113     public java.lang.String getContent(\r
114     ) {\r
115         return this._content;\r
116     }\r
117 \r
118     /**\r
119      * Returns the value of field 'name'.\r
120      * \r
121      * @return the value of field 'Name'.\r
122      */\r
123     public java.lang.String getName(\r
124     ) {\r
125         return this._name;\r
126     }\r
127 \r
128     /**\r
129      * Returns the value of field 'type'. The field 'type' has the\r
130      * following description: The type specifies how the property\r
131      * will be parsed.\r
132      *  Empty property strings are allowed, and can be used to\r
133      * prototype the\r
134      *  input to a document. TODO: specify allowed types \r
135      * \r
136      * @return the value of field 'Type'.\r
137      */\r
138     public java.lang.String getType(\r
139     ) {\r
140         return this._type;\r
141     }\r
142 \r
143     /**\r
144      * Overrides the java.lang.Object.hashCode method.\r
145      * <p>\r
146      * The following steps came from <b>Effective Java Programming\r
147      * Language Guide</b> by Joshua Bloch, Chapter 3\r
148      * \r
149      * @return a hash code value for the object.\r
150      */\r
151     public int hashCode(\r
152     ) {\r
153         int result = super.hashCode();\r
154         \r
155         long tmp;\r
156         if (_content != null) {\r
157            result = 37 * result + _content.hashCode();\r
158         }\r
159         if (_name != null) {\r
160            result = 37 * result + _name.hashCode();\r
161         }\r
162         if (_type != null) {\r
163            result = 37 * result + _type.hashCode();\r
164         }\r
165         \r
166         return result;\r
167     }\r
168 \r
169     /**\r
170      * Method isValid.\r
171      * \r
172      * @return true if this object is valid according to the schema\r
173      */\r
174     public boolean isValid(\r
175     ) {\r
176         try {\r
177             validate();\r
178         } catch (org.exolab.castor.xml.ValidationException vex) {\r
179             return false;\r
180         }\r
181         return true;\r
182     }\r
183 \r
184     /**\r
185      * \r
186      * \r
187      * @param out\r
188      * @throws org.exolab.castor.xml.MarshalException if object is\r
189      * null or if any SAXException is thrown during marshaling\r
190      * @throws org.exolab.castor.xml.ValidationException if this\r
191      * object is an invalid instance according to the schema\r
192      */\r
193     public void marshal(\r
194             final java.io.Writer out)\r
195     throws org.exolab.castor.xml.MarshalException, org.exolab.castor.xml.ValidationException {\r
196         Marshaller.marshal(this, out);\r
197     }\r
198 \r
199     /**\r
200      * \r
201      * \r
202      * @param handler\r
203      * @throws java.io.IOException if an IOException occurs during\r
204      * marshaling\r
205      * @throws org.exolab.castor.xml.ValidationException if this\r
206      * object is an invalid instance according to the schema\r
207      * @throws org.exolab.castor.xml.MarshalException if object is\r
208      * null or if any SAXException is thrown during marshaling\r
209      */\r
210     public void marshal(\r
211             final org.xml.sax.ContentHandler handler)\r
212     throws java.io.IOException, org.exolab.castor.xml.MarshalException, org.exolab.castor.xml.ValidationException {\r
213         Marshaller.marshal(this, handler);\r
214     }\r
215 \r
216     /**\r
217      * Sets the value of field 'content'. The field 'content' has\r
218      * the following description: internal content storage\r
219      * \r
220      * @param content the value of field 'content'.\r
221      */\r
222     public void setContent(\r
223             final java.lang.String content) {\r
224         this._content = content;\r
225     }\r
226 \r
227     /**\r
228      * Sets the value of field 'name'.\r
229      * \r
230      * @param name the value of field 'name'.\r
231      */\r
232     public void setName(\r
233             final java.lang.String name) {\r
234         this._name = name;\r
235     }\r
236 \r
237     /**\r
238      * Sets the value of field 'type'. The field 'type' has the\r
239      * following description: The type specifies how the property\r
240      * will be parsed.\r
241      *  Empty property strings are allowed, and can be used to\r
242      * prototype the\r
243      *  input to a document. TODO: specify allowed types \r
244      * \r
245      * @param type the value of field 'type'.\r
246      */\r
247     public void setType(\r
248             final java.lang.String type) {\r
249         this._type = type;\r
250     }\r
251 \r
252     /**\r
253      * Method unmarshal.\r
254      * \r
255      * @param reader\r
256      * @throws org.exolab.castor.xml.MarshalException if object is\r
257      * null or if any SAXException is thrown during marshaling\r
258      * @throws org.exolab.castor.xml.ValidationException if this\r
259      * object is an invalid instance according to the schema\r
260      * @return the unmarshaled uk.ac.vamsas.objects.core.Property\r
261      */\r
262     public static uk.ac.vamsas.objects.core.Property unmarshal(\r
263             final java.io.Reader reader)\r
264     throws org.exolab.castor.xml.MarshalException, org.exolab.castor.xml.ValidationException {\r
265         return (uk.ac.vamsas.objects.core.Property) Unmarshaller.unmarshal(uk.ac.vamsas.objects.core.Property.class, reader);\r
266     }\r
267 \r
268     /**\r
269      * \r
270      * \r
271      * @throws org.exolab.castor.xml.ValidationException if this\r
272      * object is an invalid instance according to the schema\r
273      */\r
274     public void validate(\r
275     )\r
276     throws org.exolab.castor.xml.ValidationException {\r
277         org.exolab.castor.xml.Validator validator = new org.exolab.castor.xml.Validator();\r
278         validator.validate(this);\r
279     }\r
280 \r
281 }\r