5857595385e48c845fe6b70e22998c1dea6eeecb
[jalview.git] / src / jalview / binding / SequenceType.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.binding;
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 SequenceType.
29  * 
30  * @version $Revision$ $Date$
31  */
32 public class SequenceType implements java.io.Serializable
33 {
34
35   // --------------------------/
36   // - Class/Member Variables -/
37   // --------------------------/
38
39   /**
40    * Field _id.
41    */
42   private java.lang.String _id;
43
44   /**
45    * Field _sequence.
46    */
47   private java.lang.String _sequence;
48
49   /**
50    * Field _name.
51    */
52   private java.lang.String _name;
53
54   // ----------------/
55   // - Constructors -/
56   // ----------------/
57
58   public SequenceType()
59   {
60     super();
61   }
62
63   // -----------/
64   // - Methods -/
65   // -----------/
66
67   /**
68    * Returns the value of field 'id'.
69    * 
70    * @return the value of field 'Id'.
71    */
72   public java.lang.String getId()
73   {
74     return this._id;
75   }
76
77   /**
78    * Returns the value of field 'name'.
79    * 
80    * @return the value of field 'Name'.
81    */
82   public java.lang.String getName()
83   {
84     return this._name;
85   }
86
87   /**
88    * Returns the value of field 'sequence'.
89    * 
90    * @return the value of field 'Sequence'.
91    */
92   public java.lang.String getSequence()
93   {
94     return this._sequence;
95   }
96
97   /**
98    * Method isValid.
99    * 
100    * @return true if this object is valid according to the schema
101    */
102   public boolean isValid()
103   {
104     try
105     {
106       validate();
107     } catch (org.exolab.castor.xml.ValidationException vex)
108     {
109       return false;
110     }
111     return true;
112   }
113
114   /**
115    * 
116    * 
117    * @param out
118    * @throws org.exolab.castor.xml.MarshalException
119    *           if object is null or if any SAXException is thrown during
120    *           marshaling
121    * @throws org.exolab.castor.xml.ValidationException
122    *           if this object is an invalid instance according to the schema
123    */
124   public void marshal(final java.io.Writer out)
125           throws org.exolab.castor.xml.MarshalException,
126           org.exolab.castor.xml.ValidationException
127   {
128     Marshaller.marshal(this, out);
129   }
130
131   /**
132    * 
133    * 
134    * @param handler
135    * @throws java.io.IOException
136    *           if an IOException occurs during marshaling
137    * @throws org.exolab.castor.xml.ValidationException
138    *           if this object is an invalid instance according to the schema
139    * @throws org.exolab.castor.xml.MarshalException
140    *           if object is null or if any SAXException is thrown during
141    *           marshaling
142    */
143   public void marshal(final org.xml.sax.ContentHandler handler)
144           throws java.io.IOException,
145           org.exolab.castor.xml.MarshalException,
146           org.exolab.castor.xml.ValidationException
147   {
148     Marshaller.marshal(this, handler);
149   }
150
151   /**
152    * Sets the value of field 'id'.
153    * 
154    * @param id
155    *          the value of field 'id'.
156    */
157   public void setId(final java.lang.String id)
158   {
159     this._id = id;
160   }
161
162   /**
163    * Sets the value of field 'name'.
164    * 
165    * @param name
166    *          the value of field 'name'.
167    */
168   public void setName(final java.lang.String name)
169   {
170     this._name = name;
171   }
172
173   /**
174    * Sets the value of field 'sequence'.
175    * 
176    * @param sequence
177    *          the value of field 'sequence'.
178    */
179   public void setSequence(final java.lang.String sequence)
180   {
181     this._sequence = sequence;
182   }
183
184   /**
185    * Method unmarshal.
186    * 
187    * @param reader
188    * @throws org.exolab.castor.xml.MarshalException
189    *           if object is null or if any SAXException is thrown during
190    *           marshaling
191    * @throws org.exolab.castor.xml.ValidationException
192    *           if this object is an invalid instance according to the schema
193    * @return the unmarshaled jalview.binding.SequenceType
194    */
195   public static jalview.binding.SequenceType unmarshal(
196           final java.io.Reader reader)
197           throws org.exolab.castor.xml.MarshalException,
198           org.exolab.castor.xml.ValidationException
199   {
200     return (jalview.binding.SequenceType) Unmarshaller.unmarshal(
201             jalview.binding.SequenceType.class, reader);
202   }
203
204   /**
205    * 
206    * 
207    * @throws org.exolab.castor.xml.ValidationException
208    *           if this object is an invalid instance according to the schema
209    */
210   public void validate() throws org.exolab.castor.xml.ValidationException
211   {
212     org.exolab.castor.xml.Validator validator = new org.exolab.castor.xml.Validator();
213     validator.validate(this);
214   }
215
216 }