2 * This class was automatically generated with
\r
3 * <a href="http://www.castor.org">Castor 1.1</a>, using an XML
\r
8 package uk.ac.vamsas.objects.core;
\r
10 //---------------------------------/
\r
11 //- Imported classes and packages -/
\r
12 //---------------------------------/
\r
14 import org.exolab.castor.xml.Marshaller;
\r
15 import org.exolab.castor.xml.Unmarshaller;
\r
20 * @version $Revision$ $Date$
\r
22 public class Instance extends uk.ac.vamsas.objects.core.AppData
\r
23 implements java.io.Serializable
\r
27 //--------------------------/
\r
28 //- Class/Member Variables -/
\r
29 //--------------------------/
\r
34 private java.lang.String _urn;
\r
51 * Overrides the java.lang.Object.equals method.
\r
54 * @return true if the objects are equal.
\r
56 public boolean equals(
\r
57 final java.lang.Object obj) {
\r
61 if (super.equals(obj)==false)
\r
64 if (obj instanceof Instance) {
\r
66 Instance temp = (Instance)obj;
\r
69 if (this._urn != null) {
\r
70 if (temp._urn == null) return false;
\r
71 if (this._urn != temp._urn) {
\r
72 thcycle=org.castor.util.CycleBreaker.startingToCycle(this._urn);
\r
73 tmcycle=org.castor.util.CycleBreaker.startingToCycle(temp._urn);
\r
74 if (thcycle!=tmcycle) {
\r
75 if (!thcycle) { org.castor.util.CycleBreaker.releaseCycleHandle(this._urn); };
\r
76 if (!tmcycle) { org.castor.util.CycleBreaker.releaseCycleHandle(temp._urn); };
\r
80 if (!this._urn.equals(temp._urn)) {
\r
81 org.castor.util.CycleBreaker.releaseCycleHandle(this._urn);
\r
82 org.castor.util.CycleBreaker.releaseCycleHandle(temp._urn);
\r
85 org.castor.util.CycleBreaker.releaseCycleHandle(this._urn);
\r
86 org.castor.util.CycleBreaker.releaseCycleHandle(temp._urn);
\r
89 } else if (temp._urn != null)
\r
97 * Returns the value of field 'urn'.
\r
99 * @return the value of field 'Urn'.
\r
101 public java.lang.String getUrn(
\r
107 * Overrides the java.lang.Object.hashCode method.
\r
109 * The following steps came from <b>Effective Java Programming
\r
110 * Language Guide</b> by Joshua Bloch, Chapter 3
\r
112 * @return a hash code value for the object.
\r
114 public int hashCode(
\r
116 int result = super.hashCode();
\r
120 && !org.castor.util.CycleBreaker.startingToCycle(_urn)) {
\r
121 result = 37 * result + _urn.hashCode();
\r
122 org.castor.util.CycleBreaker.releaseCycleHandle(_urn);
\r
131 * @return true if this object is valid according to the schema
\r
133 public boolean isValid(
\r
137 } catch (org.exolab.castor.xml.ValidationException vex) {
\r
147 * @throws org.exolab.castor.xml.MarshalException if object is
\r
148 * null or if any SAXException is thrown during marshaling
\r
149 * @throws org.exolab.castor.xml.ValidationException if this
\r
150 * object is an invalid instance according to the schema
\r
152 public void marshal(
\r
153 final java.io.Writer out)
\r
154 throws org.exolab.castor.xml.MarshalException, org.exolab.castor.xml.ValidationException {
\r
155 Marshaller.marshal(this, out);
\r
162 * @throws java.io.IOException if an IOException occurs during
\r
164 * @throws org.exolab.castor.xml.ValidationException if this
\r
165 * object is an invalid instance according to the schema
\r
166 * @throws org.exolab.castor.xml.MarshalException if object is
\r
167 * null or if any SAXException is thrown during marshaling
\r
169 public void marshal(
\r
170 final org.xml.sax.ContentHandler handler)
\r
171 throws java.io.IOException, org.exolab.castor.xml.MarshalException, org.exolab.castor.xml.ValidationException {
\r
172 Marshaller.marshal(this, handler);
\r
176 * Sets the value of field 'urn'.
\r
178 * @param urn the value of field 'urn'.
\r
180 public void setUrn(
\r
181 final java.lang.String urn) {
\r
186 * Method unmarshal.
\r
189 * @throws org.exolab.castor.xml.MarshalException if object is
\r
190 * null or if any SAXException is thrown during marshaling
\r
191 * @throws org.exolab.castor.xml.ValidationException if this
\r
192 * object is an invalid instance according to the schema
\r
193 * @return the unmarshaled uk.ac.vamsas.objects.core.AppData
\r
195 public static uk.ac.vamsas.objects.core.AppData unmarshal(
\r
196 final java.io.Reader reader)
\r
197 throws org.exolab.castor.xml.MarshalException, org.exolab.castor.xml.ValidationException {
\r
198 return (uk.ac.vamsas.objects.core.AppData) Unmarshaller.unmarshal(uk.ac.vamsas.objects.core.Instance.class, reader);
\r
204 * @throws org.exolab.castor.xml.ValidationException if this
\r
205 * object is an invalid instance according to the schema
\r
207 public void validate(
\r
209 throws org.exolab.castor.xml.ValidationException {
\r
210 org.exolab.castor.xml.Validator validator = new org.exolab.castor.xml.Validator();
\r
211 validator.validate(this);
\r