Jalview 2.6 source licence
[jalview.git] / src / jalview / schemabinding / version2 / descriptors / AnnotationColoursDescriptor.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.AnnotationColours;\r
25 \r
26 /**\r
27  * Class AnnotationColoursDescriptor.\r
28  * \r
29  * @version $Revision$ $Date$\r
30  */\r
31 public class AnnotationColoursDescriptor 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 AnnotationColoursDescriptor()\r
64   {\r
65     super();\r
66     _nsURI = "www.jalview.org";\r
67     _xmlName = "AnnotationColours";\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     // -- _aboveThreshold\r
75     desc = new org.exolab.castor.xml.util.XMLFieldDescriptorImpl(\r
76             java.lang.Integer.TYPE, "_aboveThreshold", "aboveThreshold",\r
77             org.exolab.castor.xml.NodeType.Attribute);\r
78     handler = new org.exolab.castor.xml.XMLFieldHandler()\r
79     {\r
80       public java.lang.Object getValue(java.lang.Object object)\r
81               throws IllegalStateException\r
82       {\r
83         AnnotationColours target = (AnnotationColours) object;\r
84         if (!target.hasAboveThreshold())\r
85         {\r
86           return null;\r
87         }\r
88         return new java.lang.Integer(target.getAboveThreshold());\r
89       }\r
90 \r
91       public void setValue(java.lang.Object object, java.lang.Object value)\r
92               throws IllegalStateException, IllegalArgumentException\r
93       {\r
94         try\r
95         {\r
96           AnnotationColours target = (AnnotationColours) object;\r
97           // if null, use delete method for optional primitives\r
98           if (value == null)\r
99           {\r
100             target.deleteAboveThreshold();\r
101             return;\r
102           }\r
103           target.setAboveThreshold(((java.lang.Integer) value).intValue());\r
104         } catch (java.lang.Exception ex)\r
105         {\r
106           throw new IllegalStateException(ex.toString());\r
107         }\r
108       }\r
109 \r
110       public java.lang.Object newInstance(java.lang.Object parent)\r
111       {\r
112         return null;\r
113       }\r
114     };\r
115     desc.setHandler(handler);\r
116     desc.setMultivalued(false);\r
117     addFieldDescriptor(desc);\r
118 \r
119     // -- validation code for: _aboveThreshold\r
120     fieldValidator = new org.exolab.castor.xml.FieldValidator();\r
121     { // -- local scope\r
122       org.exolab.castor.xml.validators.IntValidator typeValidator;\r
123       typeValidator = new org.exolab.castor.xml.validators.IntValidator();\r
124       fieldValidator.setValidator(typeValidator);\r
125       typeValidator.setMinInclusive(-2147483648);\r
126       typeValidator.setMaxInclusive(2147483647);\r
127     }\r
128     desc.setValidator(fieldValidator);\r
129     // -- _annotation\r
130     desc = new org.exolab.castor.xml.util.XMLFieldDescriptorImpl(\r
131             java.lang.String.class, "_annotation", "annotation",\r
132             org.exolab.castor.xml.NodeType.Attribute);\r
133     desc.setImmutable(true);\r
134     handler = new org.exolab.castor.xml.XMLFieldHandler()\r
135     {\r
136       public java.lang.Object getValue(java.lang.Object object)\r
137               throws IllegalStateException\r
138       {\r
139         AnnotationColours target = (AnnotationColours) object;\r
140         return target.getAnnotation();\r
141       }\r
142 \r
143       public void setValue(java.lang.Object object, java.lang.Object value)\r
144               throws IllegalStateException, IllegalArgumentException\r
145       {\r
146         try\r
147         {\r
148           AnnotationColours target = (AnnotationColours) object;\r
149           target.setAnnotation((java.lang.String) value);\r
150         } catch (java.lang.Exception ex)\r
151         {\r
152           throw new IllegalStateException(ex.toString());\r
153         }\r
154       }\r
155 \r
156       public java.lang.Object newInstance(java.lang.Object parent)\r
157       {\r
158         return null;\r
159       }\r
160     };\r
161     desc.setHandler(handler);\r
162     desc.setMultivalued(false);\r
163     addFieldDescriptor(desc);\r
164 \r
165     // -- validation code for: _annotation\r
166     fieldValidator = new org.exolab.castor.xml.FieldValidator();\r
167     { // -- local scope\r
168       org.exolab.castor.xml.validators.StringValidator typeValidator;\r
169       typeValidator = new org.exolab.castor.xml.validators.StringValidator();\r
170       fieldValidator.setValidator(typeValidator);\r
171       typeValidator.setWhiteSpace("preserve");\r
172     }\r
173     desc.setValidator(fieldValidator);\r
174     // -- _minColour\r
175     desc = new org.exolab.castor.xml.util.XMLFieldDescriptorImpl(\r
176             java.lang.Integer.TYPE, "_minColour", "minColour",\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         AnnotationColours target = (AnnotationColours) object;\r
184         if (!target.hasMinColour())\r
185         {\r
186           return null;\r
187         }\r
188         return new java.lang.Integer(target.getMinColour());\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           AnnotationColours target = (AnnotationColours) object;\r
197           // if null, use delete method for optional primitives\r
198           if (value == null)\r
199           {\r
200             target.deleteMinColour();\r
201             return;\r
202           }\r
203           target.setMinColour(((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: _minColour\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     // -- _maxColour\r
230     desc = new org.exolab.castor.xml.util.XMLFieldDescriptorImpl(\r
231             java.lang.Integer.TYPE, "_maxColour", "maxColour",\r
232             org.exolab.castor.xml.NodeType.Attribute);\r
233     handler = new org.exolab.castor.xml.XMLFieldHandler()\r
234     {\r
235       public java.lang.Object getValue(java.lang.Object object)\r
236               throws IllegalStateException\r
237       {\r
238         AnnotationColours target = (AnnotationColours) object;\r
239         if (!target.hasMaxColour())\r
240         {\r
241           return null;\r
242         }\r
243         return new java.lang.Integer(target.getMaxColour());\r
244       }\r
245 \r
246       public void setValue(java.lang.Object object, java.lang.Object value)\r
247               throws IllegalStateException, IllegalArgumentException\r
248       {\r
249         try\r
250         {\r
251           AnnotationColours target = (AnnotationColours) object;\r
252           // if null, use delete method for optional primitives\r
253           if (value == null)\r
254           {\r
255             target.deleteMaxColour();\r
256             return;\r
257           }\r
258           target.setMaxColour(((java.lang.Integer) value).intValue());\r
259         } catch (java.lang.Exception ex)\r
260         {\r
261           throw new IllegalStateException(ex.toString());\r
262         }\r
263       }\r
264 \r
265       public java.lang.Object newInstance(java.lang.Object parent)\r
266       {\r
267         return null;\r
268       }\r
269     };\r
270     desc.setHandler(handler);\r
271     desc.setMultivalued(false);\r
272     addFieldDescriptor(desc);\r
273 \r
274     // -- validation code for: _maxColour\r
275     fieldValidator = new org.exolab.castor.xml.FieldValidator();\r
276     { // -- local scope\r
277       org.exolab.castor.xml.validators.IntValidator typeValidator;\r
278       typeValidator = new org.exolab.castor.xml.validators.IntValidator();\r
279       fieldValidator.setValidator(typeValidator);\r
280       typeValidator.setMinInclusive(-2147483648);\r
281       typeValidator.setMaxInclusive(2147483647);\r
282     }\r
283     desc.setValidator(fieldValidator);\r
284     // -- _colourScheme\r
285     desc = new org.exolab.castor.xml.util.XMLFieldDescriptorImpl(\r
286             java.lang.String.class, "_colourScheme", "colourScheme",\r
287             org.exolab.castor.xml.NodeType.Attribute);\r
288     desc.setImmutable(true);\r
289     handler = new org.exolab.castor.xml.XMLFieldHandler()\r
290     {\r
291       public java.lang.Object getValue(java.lang.Object object)\r
292               throws IllegalStateException\r
293       {\r
294         AnnotationColours target = (AnnotationColours) object;\r
295         return target.getColourScheme();\r
296       }\r
297 \r
298       public void setValue(java.lang.Object object, java.lang.Object value)\r
299               throws IllegalStateException, IllegalArgumentException\r
300       {\r
301         try\r
302         {\r
303           AnnotationColours target = (AnnotationColours) object;\r
304           target.setColourScheme((java.lang.String) value);\r
305         } catch (java.lang.Exception ex)\r
306         {\r
307           throw new IllegalStateException(ex.toString());\r
308         }\r
309       }\r
310 \r
311       public java.lang.Object newInstance(java.lang.Object parent)\r
312       {\r
313         return null;\r
314       }\r
315     };\r
316     desc.setHandler(handler);\r
317     desc.setMultivalued(false);\r
318     addFieldDescriptor(desc);\r
319 \r
320     // -- validation code for: _colourScheme\r
321     fieldValidator = new org.exolab.castor.xml.FieldValidator();\r
322     { // -- local scope\r
323       org.exolab.castor.xml.validators.StringValidator typeValidator;\r
324       typeValidator = new org.exolab.castor.xml.validators.StringValidator();\r
325       fieldValidator.setValidator(typeValidator);\r
326       typeValidator.setWhiteSpace("preserve");\r
327     }\r
328     desc.setValidator(fieldValidator);\r
329     // -- _threshold\r
330     desc = new org.exolab.castor.xml.util.XMLFieldDescriptorImpl(\r
331             java.lang.Float.TYPE, "_threshold", "threshold",\r
332             org.exolab.castor.xml.NodeType.Attribute);\r
333     handler = new org.exolab.castor.xml.XMLFieldHandler()\r
334     {\r
335       public java.lang.Object getValue(java.lang.Object object)\r
336               throws IllegalStateException\r
337       {\r
338         AnnotationColours target = (AnnotationColours) object;\r
339         if (!target.hasThreshold())\r
340         {\r
341           return null;\r
342         }\r
343         return new java.lang.Float(target.getThreshold());\r
344       }\r
345 \r
346       public void setValue(java.lang.Object object, java.lang.Object value)\r
347               throws IllegalStateException, IllegalArgumentException\r
348       {\r
349         try\r
350         {\r
351           AnnotationColours target = (AnnotationColours) object;\r
352           // if null, use delete method for optional primitives\r
353           if (value == null)\r
354           {\r
355             target.deleteThreshold();\r
356             return;\r
357           }\r
358           target.setThreshold(((java.lang.Float) value).floatValue());\r
359         } catch (java.lang.Exception ex)\r
360         {\r
361           throw new IllegalStateException(ex.toString());\r
362         }\r
363       }\r
364 \r
365       public java.lang.Object newInstance(java.lang.Object parent)\r
366       {\r
367         return null;\r
368       }\r
369     };\r
370     desc.setHandler(handler);\r
371     desc.setMultivalued(false);\r
372     addFieldDescriptor(desc);\r
373 \r
374     // -- validation code for: _threshold\r
375     fieldValidator = new org.exolab.castor.xml.FieldValidator();\r
376     { // -- local scope\r
377       org.exolab.castor.xml.validators.FloatValidator typeValidator;\r
378       typeValidator = new org.exolab.castor.xml.validators.FloatValidator();\r
379       fieldValidator.setValidator(typeValidator);\r
380       typeValidator.setMinInclusive((float) -3.4028235E38);\r
381       typeValidator.setMaxInclusive((float) 3.4028235E38);\r
382     }\r
383     desc.setValidator(fieldValidator);\r
384     // -- initialize element descriptors\r
385 \r
386   }\r
387 \r
388   // -----------/\r
389   // - Methods -/\r
390   // -----------/\r
391 \r
392   /**\r
393    * Method getAccessMode.\r
394    * \r
395    * @return the access mode specified for this class.\r
396    */\r
397   public org.exolab.castor.mapping.AccessMode getAccessMode()\r
398   {\r
399     return null;\r
400   }\r
401 \r
402   /**\r
403    * Method getIdentity.\r
404    * \r
405    * @return the identity field, null if this class has no identity.\r
406    */\r
407   public org.exolab.castor.mapping.FieldDescriptor getIdentity()\r
408   {\r
409     return super.getIdentity();\r
410   }\r
411 \r
412   /**\r
413    * Method getJavaClass.\r
414    * \r
415    * @return the Java class represented by this descriptor.\r
416    */\r
417   public java.lang.Class getJavaClass()\r
418   {\r
419     return jalview.schemabinding.version2.AnnotationColours.class;\r
420   }\r
421 \r
422   /**\r
423    * Method getNameSpacePrefix.\r
424    * \r
425    * @return the namespace prefix to use when marshaling as XML.\r
426    */\r
427   public java.lang.String getNameSpacePrefix()\r
428   {\r
429     return _nsPrefix;\r
430   }\r
431 \r
432   /**\r
433    * Method getNameSpaceURI.\r
434    * \r
435    * @return the namespace URI used when marshaling and unmarshaling as XML.\r
436    */\r
437   public java.lang.String getNameSpaceURI()\r
438   {\r
439     return _nsURI;\r
440   }\r
441 \r
442   /**\r
443    * Method getValidator.\r
444    * \r
445    * @return a specific validator for the class described by this\r
446    *         ClassDescriptor.\r
447    */\r
448   public org.exolab.castor.xml.TypeValidator getValidator()\r
449   {\r
450     return this;\r
451   }\r
452 \r
453   /**\r
454    * Method getXMLName.\r
455    * \r
456    * @return the XML Name for the Class being described.\r
457    */\r
458   public java.lang.String getXMLName()\r
459   {\r
460     return _xmlName;\r
461   }\r
462 \r
463   /**\r
464    * Method isElementDefinition.\r
465    * \r
466    * @return true if XML schema definition of this Class is that of a global\r
467    *         element or element with anonymous type definition.\r
468    */\r
469   public boolean isElementDefinition()\r
470   {\r
471     return _elementDefinition;\r
472   }\r
473 \r
474 }\r