1dce78a190a6e77feb9dbb1c6aa6ccbedd3cf28d
[jalview.git] / src / jalview / schemabinding / version2 / Features.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 Features.
29  * 
30  * @version $Revision$ $Date$
31  */
32 public class Features extends Feature implements java.io.Serializable
33 {
34
35   // ----------------/
36   // - Constructors -/
37   // ----------------/
38
39   public Features()
40   {
41     super();
42   }
43
44   // -----------/
45   // - Methods -/
46   // -----------/
47
48   /**
49    * Method isValid.
50    * 
51    * @return true if this object is valid according to the schema
52    */
53   public boolean isValid()
54   {
55     try
56     {
57       validate();
58     } catch (org.exolab.castor.xml.ValidationException vex)
59     {
60       return false;
61     }
62     return true;
63   }
64
65   /**
66    * 
67    * 
68    * @param out
69    * @throws org.exolab.castor.xml.MarshalException
70    *           if object is null or if any SAXException is thrown during
71    *           marshaling
72    * @throws org.exolab.castor.xml.ValidationException
73    *           if this object is an invalid instance according to the schema
74    */
75   public void marshal(final java.io.Writer out)
76           throws org.exolab.castor.xml.MarshalException,
77           org.exolab.castor.xml.ValidationException
78   {
79     Marshaller.marshal(this, out);
80   }
81
82   /**
83    * 
84    * 
85    * @param handler
86    * @throws java.io.IOException
87    *           if an IOException occurs during marshaling
88    * @throws org.exolab.castor.xml.ValidationException
89    *           if this object is an invalid instance according to the schema
90    * @throws org.exolab.castor.xml.MarshalException
91    *           if object is null or if any SAXException is thrown during
92    *           marshaling
93    */
94   public void marshal(final org.xml.sax.ContentHandler handler)
95           throws java.io.IOException,
96           org.exolab.castor.xml.MarshalException,
97           org.exolab.castor.xml.ValidationException
98   {
99     Marshaller.marshal(this, handler);
100   }
101
102   /**
103    * Method unmarshal.
104    * 
105    * @param reader
106    * @throws org.exolab.castor.xml.MarshalException
107    *           if object is null or if any SAXException is thrown during
108    *           marshaling
109    * @throws org.exolab.castor.xml.ValidationException
110    *           if this object is an invalid instance according to the schema
111    * @return the unmarshaled jalview.schemabinding.version2.Featur
112    */
113   public static jalview.schemabinding.version2.Feature unmarshal(
114           final java.io.Reader reader)
115           throws org.exolab.castor.xml.MarshalException,
116           org.exolab.castor.xml.ValidationException
117   {
118     return (jalview.schemabinding.version2.Feature) Unmarshaller.unmarshal(
119             jalview.schemabinding.version2.Features.class, reader);
120   }
121
122   /**
123    * 
124    * 
125    * @throws org.exolab.castor.xml.ValidationException
126    *           if this object is an invalid instance according to the schema
127    */
128   public void validate() throws org.exolab.castor.xml.ValidationException
129   {
130     org.exolab.castor.xml.Validator validator = new org.exolab.castor.xml.Validator();
131     validator.validate(this);
132   }
133
134 }