ce54ffd4c3f2ff4e9d2bdf04eb09dd8fae7a595d
[jalview.git] / src / jalview / schemabinding / version2 / Property.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 Property.\r
30  * \r
31  * @version $Revision$ $Date$\r
32  */\r
33 public class Property implements java.io.Serializable\r
34 {\r
35 \r
36   // --------------------------/\r
37   // - Class/Member Variables -/\r
38   // --------------------------/\r
39 \r
40   /**\r
41    * Field _name.\r
42    */\r
43   private java.lang.String _name;\r
44 \r
45   /**\r
46    * Field _value.\r
47    */\r
48   private java.lang.String _value;\r
49 \r
50   // ----------------/\r
51   // - Constructors -/\r
52   // ----------------/\r
53 \r
54   public Property()\r
55   {\r
56     super();\r
57   }\r
58 \r
59   // -----------/\r
60   // - Methods -/\r
61   // -----------/\r
62 \r
63   /**\r
64    * Returns the value of field 'name'.\r
65    * \r
66    * @return the value of field 'Name'.\r
67    */\r
68   public java.lang.String getName()\r
69   {\r
70     return this._name;\r
71   }\r
72 \r
73   /**\r
74    * Returns the value of field 'value'.\r
75    * \r
76    * @return the value of field 'Value'.\r
77    */\r
78   public java.lang.String getValue()\r
79   {\r
80     return this._value;\r
81   }\r
82 \r
83   /**\r
84    * Method isValid.\r
85    * \r
86    * @return true if this object is valid according to the schema\r
87    */\r
88   public boolean isValid()\r
89   {\r
90     try\r
91     {\r
92       validate();\r
93     } catch (org.exolab.castor.xml.ValidationException vex)\r
94     {\r
95       return false;\r
96     }\r
97     return true;\r
98   }\r
99 \r
100   /**\r
101    * \r
102    * \r
103    * @param out\r
104    * @throws org.exolab.castor.xml.MarshalException\r
105    *                 if object is null or if any SAXException is thrown during\r
106    *                 marshaling\r
107    * @throws org.exolab.castor.xml.ValidationException\r
108    *                 if this object is an invalid instance according to the\r
109    *                 schema\r
110    */\r
111   public void marshal(final java.io.Writer out)\r
112           throws org.exolab.castor.xml.MarshalException,\r
113           org.exolab.castor.xml.ValidationException\r
114   {\r
115     Marshaller.marshal(this, out);\r
116   }\r
117 \r
118   /**\r
119    * \r
120    * \r
121    * @param handler\r
122    * @throws java.io.IOException\r
123    *                 if an IOException occurs during marshaling\r
124    * @throws org.exolab.castor.xml.ValidationException\r
125    *                 if this object is an invalid instance according to the\r
126    *                 schema\r
127    * @throws org.exolab.castor.xml.MarshalException\r
128    *                 if object is null or if any SAXException is thrown during\r
129    *                 marshaling\r
130    */\r
131   public void marshal(final org.xml.sax.ContentHandler handler)\r
132           throws java.io.IOException,\r
133           org.exolab.castor.xml.MarshalException,\r
134           org.exolab.castor.xml.ValidationException\r
135   {\r
136     Marshaller.marshal(this, handler);\r
137   }\r
138 \r
139   /**\r
140    * Sets the value of field 'name'.\r
141    * \r
142    * @param name\r
143    *                the value of field 'name'.\r
144    */\r
145   public void setName(final java.lang.String name)\r
146   {\r
147     this._name = name;\r
148   }\r
149 \r
150   /**\r
151    * Sets the value of field 'value'.\r
152    * \r
153    * @param value\r
154    *                the value of field 'value'.\r
155    */\r
156   public void setValue(final java.lang.String value)\r
157   {\r
158     this._value = value;\r
159   }\r
160 \r
161   /**\r
162    * Method unmarshal.\r
163    * \r
164    * @param reader\r
165    * @throws org.exolab.castor.xml.MarshalException\r
166    *                 if object is null or if any SAXException is thrown during\r
167    *                 marshaling\r
168    * @throws org.exolab.castor.xml.ValidationException\r
169    *                 if this object is an invalid instance according to the\r
170    *                 schema\r
171    * @return the unmarshaled jalview.schemabinding.version2.Property\r
172    */\r
173   public static jalview.schemabinding.version2.Property unmarshal(\r
174           final java.io.Reader reader)\r
175           throws org.exolab.castor.xml.MarshalException,\r
176           org.exolab.castor.xml.ValidationException\r
177   {\r
178     return (jalview.schemabinding.version2.Property) Unmarshaller\r
179             .unmarshal(jalview.schemabinding.version2.Property.class,\r
180                     reader);\r
181   }\r
182 \r
183   /**\r
184    * \r
185    * \r
186    * @throws org.exolab.castor.xml.ValidationException\r
187    *                 if this object is an invalid instance according to the\r
188    *                 schema\r
189    */\r
190   public void validate() throws org.exolab.castor.xml.ValidationException\r
191   {\r
192     org.exolab.castor.xml.Validator validator = new org.exolab.castor.xml.Validator();\r
193     validator.validate(this);\r
194   }\r
195 \r
196 }\r