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