cyclic IDREF patched castor-1.1.1 source
[vamsas.git] / src / uk / ac / vamsas / objects / core / Link.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 Link.\r
19  * \r
20  * @version $Revision$ $Date$\r
21  */\r
22 public class Link 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      * The URI\r
38      */\r
39     private java.lang.String _href;\r
40 \r
41 \r
42       //----------------/\r
43      //- Constructors -/\r
44     //----------------/\r
45 \r
46     public Link() {\r
47         super();\r
48         setContent("");\r
49     }\r
50 \r
51 \r
52       //-----------/\r
53      //- Methods -/\r
54     //-----------/\r
55 \r
56     /**\r
57      * Overrides the java.lang.Object.equals method.\r
58      * \r
59      * @param obj\r
60      * @return true if the objects are equal.\r
61      */\r
62     public boolean equals(\r
63             final java.lang.Object obj) {\r
64         if ( this == obj )\r
65             return true;\r
66         \r
67         if (super.equals(obj)==false)\r
68             return false;\r
69         \r
70         if (obj instanceof Link) {\r
71         \r
72             Link temp = (Link)obj;\r
73             if (this._content != null) {\r
74                 if (temp._content == null) return false;\r
75                 else if (!(this._content.equals(temp._content))) \r
76                     return false;\r
77             }\r
78             else if (temp._content != null)\r
79                 return false;\r
80             if (this._href != null) {\r
81                 if (temp._href == null) return false;\r
82                 else if (!(this._href.equals(temp._href))) \r
83                     return false;\r
84             }\r
85             else if (temp._href != null)\r
86                 return false;\r
87             return true;\r
88         }\r
89         return false;\r
90     }\r
91 \r
92     /**\r
93      * Returns the value of field 'content'. The field 'content'\r
94      * has the following description: internal content storage\r
95      * \r
96      * @return the value of field 'Content'.\r
97      */\r
98     public java.lang.String getContent(\r
99     ) {\r
100         return this._content;\r
101     }\r
102 \r
103     /**\r
104      * Returns the value of field 'href'. The field 'href' has the\r
105      * following description: The URI\r
106      * \r
107      * @return the value of field 'Href'.\r
108      */\r
109     public java.lang.String getHref(\r
110     ) {\r
111         return this._href;\r
112     }\r
113 \r
114     /**\r
115      * Overrides the java.lang.Object.hashCode method.\r
116      * <p>\r
117      * The following steps came from <b>Effective Java Programming\r
118      * Language Guide</b> by Joshua Bloch, Chapter 3\r
119      * \r
120      * @return a hash code value for the object.\r
121      */\r
122     public int hashCode(\r
123     ) {\r
124         int result = super.hashCode();\r
125         \r
126         long tmp;\r
127         if (_content != null) {\r
128            result = 37 * result + _content.hashCode();\r
129         }\r
130         if (_href != null) {\r
131            result = 37 * result + _href.hashCode();\r
132         }\r
133         \r
134         return result;\r
135     }\r
136 \r
137     /**\r
138      * Method isValid.\r
139      * \r
140      * @return true if this object is valid according to the schema\r
141      */\r
142     public boolean isValid(\r
143     ) {\r
144         try {\r
145             validate();\r
146         } catch (org.exolab.castor.xml.ValidationException vex) {\r
147             return false;\r
148         }\r
149         return true;\r
150     }\r
151 \r
152     /**\r
153      * \r
154      * \r
155      * @param out\r
156      * @throws org.exolab.castor.xml.MarshalException if object is\r
157      * null or if any SAXException is thrown during marshaling\r
158      * @throws org.exolab.castor.xml.ValidationException if this\r
159      * object is an invalid instance according to the schema\r
160      */\r
161     public void marshal(\r
162             final java.io.Writer out)\r
163     throws org.exolab.castor.xml.MarshalException, org.exolab.castor.xml.ValidationException {\r
164         Marshaller.marshal(this, out);\r
165     }\r
166 \r
167     /**\r
168      * \r
169      * \r
170      * @param handler\r
171      * @throws java.io.IOException if an IOException occurs during\r
172      * marshaling\r
173      * @throws org.exolab.castor.xml.ValidationException if this\r
174      * object is an invalid instance according to the schema\r
175      * @throws org.exolab.castor.xml.MarshalException if object is\r
176      * null or if any SAXException is thrown during marshaling\r
177      */\r
178     public void marshal(\r
179             final org.xml.sax.ContentHandler handler)\r
180     throws java.io.IOException, org.exolab.castor.xml.MarshalException, org.exolab.castor.xml.ValidationException {\r
181         Marshaller.marshal(this, handler);\r
182     }\r
183 \r
184     /**\r
185      * Sets the value of field 'content'. The field 'content' has\r
186      * the following description: internal content storage\r
187      * \r
188      * @param content the value of field 'content'.\r
189      */\r
190     public void setContent(\r
191             final java.lang.String content) {\r
192         this._content = content;\r
193     }\r
194 \r
195     /**\r
196      * Sets the value of field 'href'. The field 'href' has the\r
197      * following description: The URI\r
198      * \r
199      * @param href the value of field 'href'.\r
200      */\r
201     public void setHref(\r
202             final java.lang.String href) {\r
203         this._href = href;\r
204     }\r
205 \r
206     /**\r
207      * Method unmarshal.\r
208      * \r
209      * @param reader\r
210      * @throws org.exolab.castor.xml.MarshalException if object is\r
211      * null or if any SAXException is thrown during marshaling\r
212      * @throws org.exolab.castor.xml.ValidationException if this\r
213      * object is an invalid instance according to the schema\r
214      * @return the unmarshaled uk.ac.vamsas.objects.core.Link\r
215      */\r
216     public static uk.ac.vamsas.objects.core.Link unmarshal(\r
217             final java.io.Reader reader)\r
218     throws org.exolab.castor.xml.MarshalException, org.exolab.castor.xml.ValidationException {\r
219         return (uk.ac.vamsas.objects.core.Link) Unmarshaller.unmarshal(uk.ac.vamsas.objects.core.Link.class, reader);\r
220     }\r
221 \r
222     /**\r
223      * \r
224      * \r
225      * @throws org.exolab.castor.xml.ValidationException if this\r
226      * object is an invalid instance according to the schema\r
227      */\r
228     public void validate(\r
229     )\r
230     throws org.exolab.castor.xml.ValidationException {\r
231         org.exolab.castor.xml.Validator validator = new org.exolab.castor.xml.Validator();\r
232         validator.validate(this);\r
233     }\r
234 \r
235 }\r