e482625313de0da0d7c67518d93f2408fa9969dd
[jalview.git] / src / jalview / schemabinding / version2 / Features.java
1 /*
2  * Jalview - A Sequence Alignment Editor and Viewer (Version 2.8.2)
3  * Copyright (C) 2014 The Jalview Authors
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
10  * of the License, or (at your option) any later version.
11  *  
12  * Jalview is distributed in the hope that it will be useful, but 
13  * WITHOUT ANY WARRANTY; without even the implied warranty 
14  * of MERCHANTABILITY or FITNESS FOR A PARTICULAR 
15  * PURPOSE.  See the GNU General Public License for more details.
16  * 
17  * You should have received a copy of the GNU General Public License
18  * along with Jalview.  If not, see <http://www.gnu.org/licenses/>.
19  * The Jalview Authors are detailed in the 'AUTHORS' file.
20  */
21 package jalview.schemabinding.version2;
22
23 //---------------------------------/
24 //- Imported classes and packages -/
25 //---------------------------------/
26
27 import org.exolab.castor.xml.Marshaller;
28 import org.exolab.castor.xml.Unmarshaller;
29
30 /**
31  * Class Features.
32  * 
33  * @version $Revision$ $Date$
34  */
35 public class Features extends Feature implements java.io.Serializable
36 {
37
38   // ----------------/
39   // - Constructors -/
40   // ----------------/
41
42   public Features()
43   {
44     super();
45   }
46
47   // -----------/
48   // - Methods -/
49   // -----------/
50
51   /**
52    * Method isValid.
53    * 
54    * @return true if this object is valid according to the schema
55    */
56   public boolean isValid()
57   {
58     try
59     {
60       validate();
61     } catch (org.exolab.castor.xml.ValidationException vex)
62     {
63       return false;
64     }
65     return true;
66   }
67
68   /**
69    * 
70    * 
71    * @param out
72    * @throws org.exolab.castor.xml.MarshalException
73    *           if object is null or if any SAXException is thrown during
74    *           marshaling
75    * @throws org.exolab.castor.xml.ValidationException
76    *           if this object is an invalid instance according to the schema
77    */
78   public void marshal(final java.io.Writer out)
79           throws org.exolab.castor.xml.MarshalException,
80           org.exolab.castor.xml.ValidationException
81   {
82     Marshaller.marshal(this, out);
83   }
84
85   /**
86    * 
87    * 
88    * @param handler
89    * @throws java.io.IOException
90    *           if an IOException occurs during marshaling
91    * @throws org.exolab.castor.xml.ValidationException
92    *           if this object is an invalid instance according to the schema
93    * @throws org.exolab.castor.xml.MarshalException
94    *           if object is null or if any SAXException is thrown during
95    *           marshaling
96    */
97   public void marshal(final org.xml.sax.ContentHandler handler)
98           throws java.io.IOException,
99           org.exolab.castor.xml.MarshalException,
100           org.exolab.castor.xml.ValidationException
101   {
102     Marshaller.marshal(this, handler);
103   }
104
105   /**
106    * Method unmarshal.
107    * 
108    * @param reader
109    * @throws org.exolab.castor.xml.MarshalException
110    *           if object is null or if any SAXException is thrown during
111    *           marshaling
112    * @throws org.exolab.castor.xml.ValidationException
113    *           if this object is an invalid instance according to the schema
114    * @return the unmarshaled jalview.schemabinding.version2.Featur
115    */
116   public static jalview.schemabinding.version2.Feature unmarshal(
117           final java.io.Reader reader)
118           throws org.exolab.castor.xml.MarshalException,
119           org.exolab.castor.xml.ValidationException
120   {
121     return (jalview.schemabinding.version2.Feature) Unmarshaller.unmarshal(
122             jalview.schemabinding.version2.Features.class, reader);
123   }
124
125   /**
126    * 
127    * 
128    * @throws org.exolab.castor.xml.ValidationException
129    *           if this object is an invalid instance according to the schema
130    */
131   public void validate() throws org.exolab.castor.xml.ValidationException
132   {
133     org.exolab.castor.xml.Validator validator = new org.exolab.castor.xml.Validator();
134     validator.validate(this);
135   }
136
137 }