merge from 2_4_Release branch
[jalview.git] / src / jalview / schemabinding / version2 / Features.java
1 /*\r
2  * Jalview - A Sequence Alignment Editor and Viewer (Version 2.4)\r
3  * Copyright (C) 2008 AM Waterhouse, J Procter, G Barton, M Clamp, S Searle\r
4  * \r
5  * This program is free software; you can redistribute it and/or\r
6  * modify it under the terms of the GNU General Public License\r
7  * as published by the Free Software Foundation; either version 2\r
8  * of the License, or (at your option) any later version.\r
9  * \r
10  * This program is distributed in the hope that it will be useful,\r
11  * but WITHOUT ANY WARRANTY; without even the implied warranty of\r
12  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the\r
13  * GNU General Public License for more details.\r
14  * \r
15  * You should have received a copy of the GNU General Public License\r
16  * along with this program; if not, write to the Free Software\r
17  * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301, USA\r
18  */\r
19 package jalview.schemabinding.version2;\r
20 \r
21 // ---------------------------------/\r
22 // - Imported classes and packages -/\r
23 // ---------------------------------/\r
24 \r
25 import org.exolab.castor.xml.Marshaller;\r
26 import org.exolab.castor.xml.Unmarshaller;\r
27 \r
28 /**\r
29  * Class Features.\r
30  * \r
31  * @version $Revision$ $Date$\r
32  */\r
33 public class Features extends Feature implements java.io.Serializable\r
34 {\r
35 \r
36   // ----------------/\r
37   // - Constructors -/\r
38   // ----------------/\r
39 \r
40   public Features()\r
41   {\r
42     super();\r
43   }\r
44 \r
45   // -----------/\r
46   // - Methods -/\r
47   // -----------/\r
48 \r
49   /**\r
50    * Method isValid.\r
51    * \r
52    * @return true if this object is valid according to the schema\r
53    */\r
54   public boolean isValid()\r
55   {\r
56     try\r
57     {\r
58       validate();\r
59     } catch (org.exolab.castor.xml.ValidationException vex)\r
60     {\r
61       return false;\r
62     }\r
63     return true;\r
64   }\r
65 \r
66   /**\r
67    * \r
68    * \r
69    * @param out\r
70    * @throws org.exolab.castor.xml.MarshalException\r
71    *                 if object is null or if any SAXException is thrown during\r
72    *                 marshaling\r
73    * @throws org.exolab.castor.xml.ValidationException\r
74    *                 if this object is an invalid instance according to the\r
75    *                 schema\r
76    */\r
77   public void marshal(final java.io.Writer out)\r
78           throws org.exolab.castor.xml.MarshalException,\r
79           org.exolab.castor.xml.ValidationException\r
80   {\r
81     Marshaller.marshal(this, out);\r
82   }\r
83 \r
84   /**\r
85    * \r
86    * \r
87    * @param handler\r
88    * @throws java.io.IOException\r
89    *                 if an IOException occurs during marshaling\r
90    * @throws org.exolab.castor.xml.ValidationException\r
91    *                 if this object is an invalid instance according to the\r
92    *                 schema\r
93    * @throws org.exolab.castor.xml.MarshalException\r
94    *                 if object is null or if any SAXException is thrown during\r
95    *                 marshaling\r
96    */\r
97   public void marshal(final org.xml.sax.ContentHandler handler)\r
98           throws java.io.IOException,\r
99           org.exolab.castor.xml.MarshalException,\r
100           org.exolab.castor.xml.ValidationException\r
101   {\r
102     Marshaller.marshal(this, handler);\r
103   }\r
104 \r
105   /**\r
106    * Method unmarshal.\r
107    * \r
108    * @param reader\r
109    * @throws org.exolab.castor.xml.MarshalException\r
110    *                 if object is null or if any SAXException is thrown during\r
111    *                 marshaling\r
112    * @throws org.exolab.castor.xml.ValidationException\r
113    *                 if this object is an invalid instance according to the\r
114    *                 schema\r
115    * @return the unmarshaled jalview.schemabinding.version2.Featur\r
116    */\r
117   public static jalview.schemabinding.version2.Feature unmarshal(\r
118           final java.io.Reader reader)\r
119           throws org.exolab.castor.xml.MarshalException,\r
120           org.exolab.castor.xml.ValidationException\r
121   {\r
122     return (jalview.schemabinding.version2.Feature) Unmarshaller.unmarshal(\r
123             jalview.schemabinding.version2.Features.class, reader);\r
124   }\r
125 \r
126   /**\r
127    * \r
128    * \r
129    * @throws org.exolab.castor.xml.ValidationException\r
130    *                 if this object is an invalid instance according to the\r
131    *                 schema\r
132    */\r
133   public void validate() throws org.exolab.castor.xml.ValidationException\r
134   {\r
135     org.exolab.castor.xml.Validator validator = new org.exolab.castor.xml.Validator();\r
136     validator.validate(this);\r
137   }\r
138 \r
139 }\r