fc9edc9a262c43e91aaf08b7a0f74a4360933950
[jalview.git] / src / jalview / schemabinding / version2 / Mapping.java
1 /*\r
2  * Jalview - A Sequence Alignment Editor and Viewer (Version 2.4)\r
3  * Copyright (C) 2008 AM Waterhouse, J Procter, G Barton, M Clamp, S Searle\r
4  * \r
5  * This program is free software; you can redistribute it and/or\r
6  * modify it under the terms of the GNU General Public License\r
7  * as published by the Free Software Foundation; either version 2\r
8  * of the License, or (at your option) any later version.\r
9  * \r
10  * This program is distributed in the hope that it will be useful,\r
11  * but WITHOUT ANY WARRANTY; without even the implied warranty of\r
12  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the\r
13  * GNU General Public License for more details.\r
14  * \r
15  * You should have received a copy of the GNU General Public License\r
16  * along with this program; if not, write to the Free Software\r
17  * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301, USA\r
18  */\r
19 package jalview.schemabinding.version2;\r
20 \r
21 // ---------------------------------/\r
22 // - Imported classes and packages -/\r
23 // ---------------------------------/\r
24 \r
25 import org.exolab.castor.xml.Marshaller;\r
26 import org.exolab.castor.xml.Unmarshaller;\r
27 \r
28 /**\r
29  * Class Mapping.\r
30  * \r
31  * @version $Revision$ $Date$\r
32  */\r
33 public class Mapping extends jalview.schemabinding.version2.MapListType\r
34         implements java.io.Serializable\r
35 {\r
36 \r
37   // --------------------------/\r
38   // - Class/Member Variables -/\r
39   // --------------------------/\r
40 \r
41   /**\r
42    * Internal choice value storage\r
43    */\r
44   private java.lang.Object _choiceValue;\r
45 \r
46   /**\r
47    * Field _mappingChoice.\r
48    */\r
49   private jalview.schemabinding.version2.MappingChoice _mappingChoice;\r
50 \r
51   // ----------------/\r
52   // - Constructors -/\r
53   // ----------------/\r
54 \r
55   public Mapping()\r
56   {\r
57     super();\r
58   }\r
59 \r
60   // -----------/\r
61   // - Methods -/\r
62   // -----------/\r
63 \r
64   /**\r
65    * Returns the value of field 'choiceValue'. The field 'choiceValue' has the\r
66    * following description: Internal choice value storage\r
67    * \r
68    * @return the value of field 'ChoiceValue'.\r
69    */\r
70   public java.lang.Object getChoiceValue()\r
71   {\r
72     return this._choiceValue;\r
73   }\r
74 \r
75   /**\r
76    * Returns the value of field 'mappingChoice'.\r
77    * \r
78    * @return the value of field 'MappingChoice'.\r
79    */\r
80   public jalview.schemabinding.version2.MappingChoice getMappingChoice()\r
81   {\r
82     return this._mappingChoice;\r
83   }\r
84 \r
85   /**\r
86    * Method isValid.\r
87    * \r
88    * @return true if this object is valid according to the schema\r
89    */\r
90   public boolean isValid()\r
91   {\r
92     try\r
93     {\r
94       validate();\r
95     } catch (org.exolab.castor.xml.ValidationException vex)\r
96     {\r
97       return false;\r
98     }\r
99     return true;\r
100   }\r
101 \r
102   /**\r
103    * \r
104    * \r
105    * @param out\r
106    * @throws org.exolab.castor.xml.MarshalException\r
107    *                 if object is null or if any SAXException is thrown during\r
108    *                 marshaling\r
109    * @throws org.exolab.castor.xml.ValidationException\r
110    *                 if this object is an invalid instance according to the\r
111    *                 schema\r
112    */\r
113   public void marshal(final java.io.Writer out)\r
114           throws org.exolab.castor.xml.MarshalException,\r
115           org.exolab.castor.xml.ValidationException\r
116   {\r
117     Marshaller.marshal(this, out);\r
118   }\r
119 \r
120   /**\r
121    * \r
122    * \r
123    * @param handler\r
124    * @throws java.io.IOException\r
125    *                 if an IOException occurs during marshaling\r
126    * @throws org.exolab.castor.xml.ValidationException\r
127    *                 if this object is an invalid instance according to the\r
128    *                 schema\r
129    * @throws org.exolab.castor.xml.MarshalException\r
130    *                 if object is null or if any SAXException is thrown during\r
131    *                 marshaling\r
132    */\r
133   public void marshal(final org.xml.sax.ContentHandler handler)\r
134           throws java.io.IOException,\r
135           org.exolab.castor.xml.MarshalException,\r
136           org.exolab.castor.xml.ValidationException\r
137   {\r
138     Marshaller.marshal(this, handler);\r
139   }\r
140 \r
141   /**\r
142    * Sets the value of field 'mappingChoice'.\r
143    * \r
144    * @param mappingChoice\r
145    *                the value of field 'mappingChoice'.\r
146    */\r
147   public void setMappingChoice(\r
148           final jalview.schemabinding.version2.MappingChoice mappingChoice)\r
149   {\r
150     this._mappingChoice = mappingChoice;\r
151     this._choiceValue = mappingChoice;\r
152   }\r
153 \r
154   /**\r
155    * Method unmarshal.\r
156    * \r
157    * @param reader\r
158    * @throws org.exolab.castor.xml.MarshalException\r
159    *                 if object is null or if any SAXException is thrown during\r
160    *                 marshaling\r
161    * @throws org.exolab.castor.xml.ValidationException\r
162    *                 if this object is an invalid instance according to the\r
163    *                 schema\r
164    * @return the unmarshaled jalview.schemabinding.version2.MapListType\r
165    */\r
166   public static jalview.schemabinding.version2.MapListType unmarshal(\r
167           final java.io.Reader reader)\r
168           throws org.exolab.castor.xml.MarshalException,\r
169           org.exolab.castor.xml.ValidationException\r
170   {\r
171     return (jalview.schemabinding.version2.MapListType) Unmarshaller\r
172             .unmarshal(jalview.schemabinding.version2.Mapping.class, reader);\r
173   }\r
174 \r
175   /**\r
176    * \r
177    * \r
178    * @throws org.exolab.castor.xml.ValidationException\r
179    *                 if this object is an invalid instance according to the\r
180    *                 schema\r
181    */\r
182   public void validate() throws org.exolab.castor.xml.ValidationException\r
183   {\r
184     org.exolab.castor.xml.Validator validator = new org.exolab.castor.xml.Validator();\r
185     validator.validate(this);\r
186   }\r
187 \r
188 }\r