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