Jalview 2.6 source licence
[jalview.git] / src / jalview / schemabinding / version2 / descriptors / ThresholdLineDescriptor.java
1 /*\r
2  * Jalview - A Sequence Alignment Editor and Viewer (Version 2.6)\r
3  * Copyright (C) 2010 J Procter, AM Waterhouse, G Barton, M Clamp, S Searle\r
4  * \r
5  * This file is part of Jalview.\r
6  * \r
7  * Jalview is free software: you can redistribute it and/or\r
8  * modify it under the terms of the GNU General Public License \r
9  * as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version.\r
10  * \r
11  * Jalview is distributed in the hope that it will be useful, but \r
12  * WITHOUT ANY WARRANTY; without even the implied warranty \r
13  * of MERCHANTABILITY or FITNESS FOR A PARTICULAR \r
14  * PURPOSE.  See the GNU General Public License for more details.\r
15  * \r
16  * You should have received a copy of the GNU General Public License along with Jalview.  If not, see <http://www.gnu.org/licenses/>.\r
17  */\r
18 package jalview.schemabinding.version2.descriptors;\r
19 \r
20 //---------------------------------/\r
21 //- Imported classes and packages -/\r
22 //---------------------------------/\r
23 \r
24 import jalview.schemabinding.version2.ThresholdLine;\r
25 \r
26 /**\r
27  * Class ThresholdLineDescriptor.\r
28  * \r
29  * @version $Revision$ $Date$\r
30  */\r
31 public class ThresholdLineDescriptor extends\r
32         org.exolab.castor.xml.util.XMLClassDescriptorImpl\r
33 {\r
34 \r
35   // --------------------------/\r
36   // - Class/Member Variables -/\r
37   // --------------------------/\r
38 \r
39   /**\r
40    * Field _elementDefinition.\r
41    */\r
42   private boolean _elementDefinition;\r
43 \r
44   /**\r
45    * Field _nsPrefix.\r
46    */\r
47   private java.lang.String _nsPrefix;\r
48 \r
49   /**\r
50    * Field _nsURI.\r
51    */\r
52   private java.lang.String _nsURI;\r
53 \r
54   /**\r
55    * Field _xmlName.\r
56    */\r
57   private java.lang.String _xmlName;\r
58 \r
59   // ----------------/\r
60   // - Constructors -/\r
61   // ----------------/\r
62 \r
63   public ThresholdLineDescriptor()\r
64   {\r
65     super();\r
66     _nsURI = "www.vamsas.ac.uk/jalview/version2";\r
67     _xmlName = "thresholdLine";\r
68     _elementDefinition = true;\r
69     org.exolab.castor.xml.util.XMLFieldDescriptorImpl desc = null;\r
70     org.exolab.castor.mapping.FieldHandler handler = null;\r
71     org.exolab.castor.xml.FieldValidator fieldValidator = null;\r
72     // -- initialize attribute descriptors\r
73 \r
74     // -- _label\r
75     desc = new org.exolab.castor.xml.util.XMLFieldDescriptorImpl(\r
76             java.lang.String.class, "_label", "label",\r
77             org.exolab.castor.xml.NodeType.Attribute);\r
78     desc.setImmutable(true);\r
79     handler = new org.exolab.castor.xml.XMLFieldHandler()\r
80     {\r
81       public java.lang.Object getValue(java.lang.Object object)\r
82               throws IllegalStateException\r
83       {\r
84         ThresholdLine target = (ThresholdLine) object;\r
85         return target.getLabel();\r
86       }\r
87 \r
88       public void setValue(java.lang.Object object, java.lang.Object value)\r
89               throws IllegalStateException, IllegalArgumentException\r
90       {\r
91         try\r
92         {\r
93           ThresholdLine target = (ThresholdLine) object;\r
94           target.setLabel((java.lang.String) value);\r
95         } catch (java.lang.Exception ex)\r
96         {\r
97           throw new IllegalStateException(ex.toString());\r
98         }\r
99       }\r
100 \r
101       public java.lang.Object newInstance(java.lang.Object parent)\r
102       {\r
103         return null;\r
104       }\r
105     };\r
106     desc.setHandler(handler);\r
107     desc.setMultivalued(false);\r
108     addFieldDescriptor(desc);\r
109 \r
110     // -- validation code for: _label\r
111     fieldValidator = new org.exolab.castor.xml.FieldValidator();\r
112     { // -- local scope\r
113       org.exolab.castor.xml.validators.StringValidator typeValidator;\r
114       typeValidator = new org.exolab.castor.xml.validators.StringValidator();\r
115       fieldValidator.setValidator(typeValidator);\r
116       typeValidator.setWhiteSpace("preserve");\r
117     }\r
118     desc.setValidator(fieldValidator);\r
119     // -- _value\r
120     desc = new org.exolab.castor.xml.util.XMLFieldDescriptorImpl(\r
121             java.lang.Float.TYPE, "_value", "value",\r
122             org.exolab.castor.xml.NodeType.Attribute);\r
123     handler = new org.exolab.castor.xml.XMLFieldHandler()\r
124     {\r
125       public java.lang.Object getValue(java.lang.Object object)\r
126               throws IllegalStateException\r
127       {\r
128         ThresholdLine target = (ThresholdLine) object;\r
129         if (!target.hasValue())\r
130         {\r
131           return null;\r
132         }\r
133         return new java.lang.Float(target.getValue());\r
134       }\r
135 \r
136       public void setValue(java.lang.Object object, java.lang.Object value)\r
137               throws IllegalStateException, IllegalArgumentException\r
138       {\r
139         try\r
140         {\r
141           ThresholdLine target = (ThresholdLine) object;\r
142           // if null, use delete method for optional primitives\r
143           if (value == null)\r
144           {\r
145             target.deleteValue();\r
146             return;\r
147           }\r
148           target.setValue(((java.lang.Float) value).floatValue());\r
149         } catch (java.lang.Exception ex)\r
150         {\r
151           throw new IllegalStateException(ex.toString());\r
152         }\r
153       }\r
154 \r
155       public java.lang.Object newInstance(java.lang.Object parent)\r
156       {\r
157         return null;\r
158       }\r
159     };\r
160     desc.setHandler(handler);\r
161     desc.setMultivalued(false);\r
162     addFieldDescriptor(desc);\r
163 \r
164     // -- validation code for: _value\r
165     fieldValidator = new org.exolab.castor.xml.FieldValidator();\r
166     { // -- local scope\r
167       org.exolab.castor.xml.validators.FloatValidator typeValidator;\r
168       typeValidator = new org.exolab.castor.xml.validators.FloatValidator();\r
169       fieldValidator.setValidator(typeValidator);\r
170       typeValidator.setMinInclusive((float) -3.4028235E38);\r
171       typeValidator.setMaxInclusive((float) 3.4028235E38);\r
172     }\r
173     desc.setValidator(fieldValidator);\r
174     // -- _colour\r
175     desc = new org.exolab.castor.xml.util.XMLFieldDescriptorImpl(\r
176             java.lang.Integer.TYPE, "_colour", "colour",\r
177             org.exolab.castor.xml.NodeType.Attribute);\r
178     handler = new org.exolab.castor.xml.XMLFieldHandler()\r
179     {\r
180       public java.lang.Object getValue(java.lang.Object object)\r
181               throws IllegalStateException\r
182       {\r
183         ThresholdLine target = (ThresholdLine) object;\r
184         if (!target.hasColour())\r
185         {\r
186           return null;\r
187         }\r
188         return new java.lang.Integer(target.getColour());\r
189       }\r
190 \r
191       public void setValue(java.lang.Object object, java.lang.Object value)\r
192               throws IllegalStateException, IllegalArgumentException\r
193       {\r
194         try\r
195         {\r
196           ThresholdLine target = (ThresholdLine) object;\r
197           // if null, use delete method for optional primitives\r
198           if (value == null)\r
199           {\r
200             target.deleteColour();\r
201             return;\r
202           }\r
203           target.setColour(((java.lang.Integer) value).intValue());\r
204         } catch (java.lang.Exception ex)\r
205         {\r
206           throw new IllegalStateException(ex.toString());\r
207         }\r
208       }\r
209 \r
210       public java.lang.Object newInstance(java.lang.Object parent)\r
211       {\r
212         return null;\r
213       }\r
214     };\r
215     desc.setHandler(handler);\r
216     desc.setMultivalued(false);\r
217     addFieldDescriptor(desc);\r
218 \r
219     // -- validation code for: _colour\r
220     fieldValidator = new org.exolab.castor.xml.FieldValidator();\r
221     { // -- local scope\r
222       org.exolab.castor.xml.validators.IntValidator typeValidator;\r
223       typeValidator = new org.exolab.castor.xml.validators.IntValidator();\r
224       fieldValidator.setValidator(typeValidator);\r
225       typeValidator.setMinInclusive(-2147483648);\r
226       typeValidator.setMaxInclusive(2147483647);\r
227     }\r
228     desc.setValidator(fieldValidator);\r
229     // -- initialize element descriptors\r
230 \r
231   }\r
232 \r
233   // -----------/\r
234   // - Methods -/\r
235   // -----------/\r
236 \r
237   /**\r
238    * Method getAccessMode.\r
239    * \r
240    * @return the access mode specified for this class.\r
241    */\r
242   public org.exolab.castor.mapping.AccessMode getAccessMode()\r
243   {\r
244     return null;\r
245   }\r
246 \r
247   /**\r
248    * Method getIdentity.\r
249    * \r
250    * @return the identity field, null if this class has no identity.\r
251    */\r
252   public org.exolab.castor.mapping.FieldDescriptor getIdentity()\r
253   {\r
254     return super.getIdentity();\r
255   }\r
256 \r
257   /**\r
258    * Method getJavaClass.\r
259    * \r
260    * @return the Java class represented by this descriptor.\r
261    */\r
262   public java.lang.Class getJavaClass()\r
263   {\r
264     return jalview.schemabinding.version2.ThresholdLine.class;\r
265   }\r
266 \r
267   /**\r
268    * Method getNameSpacePrefix.\r
269    * \r
270    * @return the namespace prefix to use when marshaling as XML.\r
271    */\r
272   public java.lang.String getNameSpacePrefix()\r
273   {\r
274     return _nsPrefix;\r
275   }\r
276 \r
277   /**\r
278    * Method getNameSpaceURI.\r
279    * \r
280    * @return the namespace URI used when marshaling and unmarshaling as XML.\r
281    */\r
282   public java.lang.String getNameSpaceURI()\r
283   {\r
284     return _nsURI;\r
285   }\r
286 \r
287   /**\r
288    * Method getValidator.\r
289    * \r
290    * @return a specific validator for the class described by this\r
291    *         ClassDescriptor.\r
292    */\r
293   public org.exolab.castor.xml.TypeValidator getValidator()\r
294   {\r
295     return this;\r
296   }\r
297 \r
298   /**\r
299    * Method getXMLName.\r
300    * \r
301    * @return the XML Name for the Class being described.\r
302    */\r
303   public java.lang.String getXMLName()\r
304   {\r
305     return _xmlName;\r
306   }\r
307 \r
308   /**\r
309    * Method isElementDefinition.\r
310    * \r
311    * @return true if XML schema definition of this Class is that of a global\r
312    *         element or element with anonymous type definition.\r
313    */\r
314   public boolean isElementDefinition()\r
315   {\r
316     return _elementDefinition;\r
317   }\r
318 \r
319 }\r