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