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