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