JAL-1620 version bump and release notes
[jalview.git] / src / jalview / schemabinding / version2 / descriptors / ColourDescriptor.java
1 /*
2  * Jalview - A Sequence Alignment Editor and Viewer (Version 2.8.2b1)
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.descriptors;
22
23 //---------------------------------/
24 //- Imported classes and packages -/
25 //---------------------------------/
26
27 import jalview.schemabinding.version2.Colour;
28
29 /**
30  * Class ColourDescriptor.
31  * 
32  * @version $Revision$ $Date$
33  */
34 public class ColourDescriptor extends
35         org.exolab.castor.xml.util.XMLClassDescriptorImpl
36 {
37
38   // --------------------------/
39   // - Class/Member Variables -/
40   // --------------------------/
41
42   /**
43    * Field _elementDefinition.
44    */
45   private boolean _elementDefinition;
46
47   /**
48    * Field _nsPrefix.
49    */
50   private java.lang.String _nsPrefix;
51
52   /**
53    * Field _nsURI.
54    */
55   private java.lang.String _nsURI;
56
57   /**
58    * Field _xmlName.
59    */
60   private java.lang.String _xmlName;
61
62   // ----------------/
63   // - Constructors -/
64   // ----------------/
65
66   public ColourDescriptor()
67   {
68     super();
69     _xmlName = "colour";
70     _elementDefinition = true;
71     org.exolab.castor.xml.util.XMLFieldDescriptorImpl desc = null;
72     org.exolab.castor.mapping.FieldHandler handler = null;
73     org.exolab.castor.xml.FieldValidator fieldValidator = null;
74     // -- initialize attribute descriptors
75
76     // -- _name
77     desc = new org.exolab.castor.xml.util.XMLFieldDescriptorImpl(
78             java.lang.String.class, "_name", "Name",
79             org.exolab.castor.xml.NodeType.Attribute);
80     desc.setImmutable(true);
81     handler = new org.exolab.castor.xml.XMLFieldHandler()
82     {
83       public java.lang.Object getValue(java.lang.Object object)
84               throws IllegalStateException
85       {
86         Colour target = (Colour) object;
87         return target.getName();
88       }
89
90       public void setValue(java.lang.Object object, java.lang.Object value)
91               throws IllegalStateException, IllegalArgumentException
92       {
93         try
94         {
95           Colour target = (Colour) object;
96           target.setName((java.lang.String) value);
97         } catch (java.lang.Exception ex)
98         {
99           throw new IllegalStateException(ex.toString());
100         }
101       }
102
103       public java.lang.Object newInstance(java.lang.Object parent)
104       {
105         return null;
106       }
107     };
108     desc.setHandler(handler);
109     desc.setMultivalued(false);
110     addFieldDescriptor(desc);
111
112     // -- validation code for: _name
113     fieldValidator = new org.exolab.castor.xml.FieldValidator();
114     { // -- local scope
115       org.exolab.castor.xml.validators.StringValidator typeValidator;
116       typeValidator = new org.exolab.castor.xml.validators.StringValidator();
117       fieldValidator.setValidator(typeValidator);
118       typeValidator.setWhiteSpace("preserve");
119     }
120     desc.setValidator(fieldValidator);
121     // -- _RGB
122     desc = new org.exolab.castor.xml.util.XMLFieldDescriptorImpl(
123             java.lang.String.class, "_RGB", "RGB",
124             org.exolab.castor.xml.NodeType.Attribute);
125     desc.setImmutable(true);
126     handler = new org.exolab.castor.xml.XMLFieldHandler()
127     {
128       public java.lang.Object getValue(java.lang.Object object)
129               throws IllegalStateException
130       {
131         Colour target = (Colour) object;
132         return target.getRGB();
133       }
134
135       public void setValue(java.lang.Object object, java.lang.Object value)
136               throws IllegalStateException, IllegalArgumentException
137       {
138         try
139         {
140           Colour target = (Colour) object;
141           target.setRGB((java.lang.String) value);
142         } catch (java.lang.Exception ex)
143         {
144           throw new IllegalStateException(ex.toString());
145         }
146       }
147
148       public java.lang.Object newInstance(java.lang.Object parent)
149       {
150         return null;
151       }
152     };
153     desc.setHandler(handler);
154     desc.setRequired(true);
155     desc.setMultivalued(false);
156     addFieldDescriptor(desc);
157
158     // -- validation code for: _RGB
159     fieldValidator = new org.exolab.castor.xml.FieldValidator();
160     fieldValidator.setMinOccurs(1);
161     { // -- local scope
162       org.exolab.castor.xml.validators.StringValidator typeValidator;
163       typeValidator = new org.exolab.castor.xml.validators.StringValidator();
164       fieldValidator.setValidator(typeValidator);
165       typeValidator.setWhiteSpace("preserve");
166     }
167     desc.setValidator(fieldValidator);
168     // -- _minRGB
169     desc = new org.exolab.castor.xml.util.XMLFieldDescriptorImpl(
170             java.lang.String.class, "_minRGB", "minRGB",
171             org.exolab.castor.xml.NodeType.Attribute);
172     desc.setImmutable(true);
173     handler = new org.exolab.castor.xml.XMLFieldHandler()
174     {
175       public java.lang.Object getValue(java.lang.Object object)
176               throws IllegalStateException
177       {
178         Colour target = (Colour) object;
179         return target.getMinRGB();
180       }
181
182       public void setValue(java.lang.Object object, java.lang.Object value)
183               throws IllegalStateException, IllegalArgumentException
184       {
185         try
186         {
187           Colour target = (Colour) object;
188           target.setMinRGB((java.lang.String) value);
189         } catch (java.lang.Exception ex)
190         {
191           throw new IllegalStateException(ex.toString());
192         }
193       }
194
195       public java.lang.Object newInstance(java.lang.Object parent)
196       {
197         return null;
198       }
199     };
200     desc.setHandler(handler);
201     desc.setMultivalued(false);
202     addFieldDescriptor(desc);
203
204     // -- validation code for: _minRGB
205     fieldValidator = new org.exolab.castor.xml.FieldValidator();
206     { // -- local scope
207       org.exolab.castor.xml.validators.StringValidator typeValidator;
208       typeValidator = new org.exolab.castor.xml.validators.StringValidator();
209       fieldValidator.setValidator(typeValidator);
210       typeValidator.setWhiteSpace("preserve");
211     }
212     desc.setValidator(fieldValidator);
213     // -- _threshType
214     desc = new org.exolab.castor.xml.util.XMLFieldDescriptorImpl(
215             java.lang.String.class, "_threshType", "threshType",
216             org.exolab.castor.xml.NodeType.Attribute);
217     desc.setImmutable(true);
218     handler = new org.exolab.castor.xml.XMLFieldHandler()
219     {
220       public java.lang.Object getValue(java.lang.Object object)
221               throws IllegalStateException
222       {
223         Colour target = (Colour) object;
224         return target.getThreshType();
225       }
226
227       public void setValue(java.lang.Object object, java.lang.Object value)
228               throws IllegalStateException, IllegalArgumentException
229       {
230         try
231         {
232           Colour target = (Colour) object;
233           target.setThreshType((java.lang.String) value);
234         } catch (java.lang.Exception ex)
235         {
236           throw new IllegalStateException(ex.toString());
237         }
238       }
239
240       public java.lang.Object newInstance(java.lang.Object parent)
241       {
242         return null;
243       }
244     };
245     desc.setHandler(handler);
246     desc.setMultivalued(false);
247     addFieldDescriptor(desc);
248
249     // -- validation code for: _threshType
250     fieldValidator = new org.exolab.castor.xml.FieldValidator();
251     { // -- local scope
252       org.exolab.castor.xml.validators.StringValidator typeValidator;
253       typeValidator = new org.exolab.castor.xml.validators.StringValidator();
254       fieldValidator.setValidator(typeValidator);
255       typeValidator.setWhiteSpace("preserve");
256     }
257     desc.setValidator(fieldValidator);
258     // -- _threshold
259     desc = new org.exolab.castor.xml.util.XMLFieldDescriptorImpl(
260             java.lang.Float.TYPE, "_threshold", "threshold",
261             org.exolab.castor.xml.NodeType.Attribute);
262     handler = new org.exolab.castor.xml.XMLFieldHandler()
263     {
264       public java.lang.Object getValue(java.lang.Object object)
265               throws IllegalStateException
266       {
267         Colour target = (Colour) object;
268         if (!target.hasThreshold())
269         {
270           return null;
271         }
272         return new java.lang.Float(target.getThreshold());
273       }
274
275       public void setValue(java.lang.Object object, java.lang.Object value)
276               throws IllegalStateException, IllegalArgumentException
277       {
278         try
279         {
280           Colour target = (Colour) object;
281           // if null, use delete method for optional primitives
282           if (value == null)
283           {
284             target.deleteThreshold();
285             return;
286           }
287           target.setThreshold(((java.lang.Float) value).floatValue());
288         } catch (java.lang.Exception ex)
289         {
290           throw new IllegalStateException(ex.toString());
291         }
292       }
293
294       public java.lang.Object newInstance(java.lang.Object parent)
295       {
296         return null;
297       }
298     };
299     desc.setHandler(handler);
300     desc.setMultivalued(false);
301     addFieldDescriptor(desc);
302
303     // -- validation code for: _threshold
304     fieldValidator = new org.exolab.castor.xml.FieldValidator();
305     { // -- local scope
306       org.exolab.castor.xml.validators.FloatValidator typeValidator;
307       typeValidator = new org.exolab.castor.xml.validators.FloatValidator();
308       fieldValidator.setValidator(typeValidator);
309       typeValidator.setMinInclusive((float) -3.4028235E38);
310       typeValidator.setMaxInclusive((float) 3.4028235E38);
311     }
312     desc.setValidator(fieldValidator);
313     // -- _max
314     desc = new org.exolab.castor.xml.util.XMLFieldDescriptorImpl(
315             java.lang.Float.TYPE, "_max", "max",
316             org.exolab.castor.xml.NodeType.Attribute);
317     handler = new org.exolab.castor.xml.XMLFieldHandler()
318     {
319       public java.lang.Object getValue(java.lang.Object object)
320               throws IllegalStateException
321       {
322         Colour target = (Colour) object;
323         if (!target.hasMax())
324         {
325           return null;
326         }
327         return new java.lang.Float(target.getMax());
328       }
329
330       public void setValue(java.lang.Object object, java.lang.Object value)
331               throws IllegalStateException, IllegalArgumentException
332       {
333         try
334         {
335           Colour target = (Colour) object;
336           // if null, use delete method for optional primitives
337           if (value == null)
338           {
339             target.deleteMax();
340             return;
341           }
342           target.setMax(((java.lang.Float) value).floatValue());
343         } catch (java.lang.Exception ex)
344         {
345           throw new IllegalStateException(ex.toString());
346         }
347       }
348
349       public java.lang.Object newInstance(java.lang.Object parent)
350       {
351         return null;
352       }
353     };
354     desc.setHandler(handler);
355     desc.setMultivalued(false);
356     addFieldDescriptor(desc);
357
358     // -- validation code for: _max
359     fieldValidator = new org.exolab.castor.xml.FieldValidator();
360     { // -- local scope
361       org.exolab.castor.xml.validators.FloatValidator typeValidator;
362       typeValidator = new org.exolab.castor.xml.validators.FloatValidator();
363       fieldValidator.setValidator(typeValidator);
364       typeValidator.setMinInclusive((float) -3.4028235E38);
365       typeValidator.setMaxInclusive((float) 3.4028235E38);
366     }
367     desc.setValidator(fieldValidator);
368     // -- _min
369     desc = new org.exolab.castor.xml.util.XMLFieldDescriptorImpl(
370             java.lang.Float.TYPE, "_min", "min",
371             org.exolab.castor.xml.NodeType.Attribute);
372     handler = new org.exolab.castor.xml.XMLFieldHandler()
373     {
374       public java.lang.Object getValue(java.lang.Object object)
375               throws IllegalStateException
376       {
377         Colour target = (Colour) object;
378         if (!target.hasMin())
379         {
380           return null;
381         }
382         return new java.lang.Float(target.getMin());
383       }
384
385       public void setValue(java.lang.Object object, java.lang.Object value)
386               throws IllegalStateException, IllegalArgumentException
387       {
388         try
389         {
390           Colour target = (Colour) object;
391           // if null, use delete method for optional primitives
392           if (value == null)
393           {
394             target.deleteMin();
395             return;
396           }
397           target.setMin(((java.lang.Float) value).floatValue());
398         } catch (java.lang.Exception ex)
399         {
400           throw new IllegalStateException(ex.toString());
401         }
402       }
403
404       public java.lang.Object newInstance(java.lang.Object parent)
405       {
406         return null;
407       }
408     };
409     desc.setHandler(handler);
410     desc.setMultivalued(false);
411     addFieldDescriptor(desc);
412
413     // -- validation code for: _min
414     fieldValidator = new org.exolab.castor.xml.FieldValidator();
415     { // -- local scope
416       org.exolab.castor.xml.validators.FloatValidator typeValidator;
417       typeValidator = new org.exolab.castor.xml.validators.FloatValidator();
418       fieldValidator.setValidator(typeValidator);
419       typeValidator.setMinInclusive((float) -3.4028235E38);
420       typeValidator.setMaxInclusive((float) 3.4028235E38);
421     }
422     desc.setValidator(fieldValidator);
423     // -- _colourByLabel
424     desc = new org.exolab.castor.xml.util.XMLFieldDescriptorImpl(
425             java.lang.Boolean.TYPE, "_colourByLabel", "colourByLabel",
426             org.exolab.castor.xml.NodeType.Attribute);
427     handler = new org.exolab.castor.xml.XMLFieldHandler()
428     {
429       public java.lang.Object getValue(java.lang.Object object)
430               throws IllegalStateException
431       {
432         Colour target = (Colour) object;
433         if (!target.hasColourByLabel())
434         {
435           return null;
436         }
437         return (target.getColourByLabel() ? java.lang.Boolean.TRUE
438                 : java.lang.Boolean.FALSE);
439       }
440
441       public void setValue(java.lang.Object object, java.lang.Object value)
442               throws IllegalStateException, IllegalArgumentException
443       {
444         try
445         {
446           Colour target = (Colour) object;
447           // if null, use delete method for optional primitives
448           if (value == null)
449           {
450             target.deleteColourByLabel();
451             return;
452           }
453           target.setColourByLabel(((java.lang.Boolean) value)
454                   .booleanValue());
455         } catch (java.lang.Exception ex)
456         {
457           throw new IllegalStateException(ex.toString());
458         }
459       }
460
461       public java.lang.Object newInstance(java.lang.Object parent)
462       {
463         return null;
464       }
465     };
466     desc.setHandler(handler);
467     desc.setMultivalued(false);
468     addFieldDescriptor(desc);
469
470     // -- validation code for: _colourByLabel
471     fieldValidator = new org.exolab.castor.xml.FieldValidator();
472     { // -- local scope
473       org.exolab.castor.xml.validators.BooleanValidator typeValidator;
474       typeValidator = new org.exolab.castor.xml.validators.BooleanValidator();
475       fieldValidator.setValidator(typeValidator);
476     }
477     desc.setValidator(fieldValidator);
478     // -- _autoScale
479     desc = new org.exolab.castor.xml.util.XMLFieldDescriptorImpl(
480             java.lang.Boolean.TYPE, "_autoScale", "autoScale",
481             org.exolab.castor.xml.NodeType.Attribute);
482     handler = new org.exolab.castor.xml.XMLFieldHandler()
483     {
484       public java.lang.Object getValue(java.lang.Object object)
485               throws IllegalStateException
486       {
487         Colour target = (Colour) object;
488         if (!target.hasAutoScale())
489         {
490           return null;
491         }
492         return (target.getAutoScale() ? java.lang.Boolean.TRUE
493                 : java.lang.Boolean.FALSE);
494       }
495
496       public void setValue(java.lang.Object object, java.lang.Object value)
497               throws IllegalStateException, IllegalArgumentException
498       {
499         try
500         {
501           Colour target = (Colour) object;
502           // if null, use delete method for optional primitives
503           if (value == null)
504           {
505             target.deleteAutoScale();
506             return;
507           }
508           target.setAutoScale(((java.lang.Boolean) value).booleanValue());
509         } catch (java.lang.Exception ex)
510         {
511           throw new IllegalStateException(ex.toString());
512         }
513       }
514
515       public java.lang.Object newInstance(java.lang.Object parent)
516       {
517         return null;
518       }
519     };
520     desc.setHandler(handler);
521     desc.setMultivalued(false);
522     addFieldDescriptor(desc);
523
524     // -- validation code for: _autoScale
525     fieldValidator = new org.exolab.castor.xml.FieldValidator();
526     { // -- local scope
527       org.exolab.castor.xml.validators.BooleanValidator typeValidator;
528       typeValidator = new org.exolab.castor.xml.validators.BooleanValidator();
529       fieldValidator.setValidator(typeValidator);
530     }
531     desc.setValidator(fieldValidator);
532     // -- initialize element descriptors
533
534   }
535
536   // -----------/
537   // - Methods -/
538   // -----------/
539
540   /**
541    * Method getAccessMode.
542    * 
543    * @return the access mode specified for this class.
544    */
545   public org.exolab.castor.mapping.AccessMode getAccessMode()
546   {
547     return null;
548   }
549
550   /**
551    * Method getIdentity.
552    * 
553    * @return the identity field, null if this class has no identity.
554    */
555   public org.exolab.castor.mapping.FieldDescriptor getIdentity()
556   {
557     return super.getIdentity();
558   }
559
560   /**
561    * Method getJavaClass.
562    * 
563    * @return the Java class represented by this descriptor.
564    */
565   public java.lang.Class getJavaClass()
566   {
567     return jalview.schemabinding.version2.Colour.class;
568   }
569
570   /**
571    * Method getNameSpacePrefix.
572    * 
573    * @return the namespace prefix to use when marshaling as XML.
574    */
575   public java.lang.String getNameSpacePrefix()
576   {
577     return _nsPrefix;
578   }
579
580   /**
581    * Method getNameSpaceURI.
582    * 
583    * @return the namespace URI used when marshaling and unmarshaling as XML.
584    */
585   public java.lang.String getNameSpaceURI()
586   {
587     return _nsURI;
588   }
589
590   /**
591    * Method getValidator.
592    * 
593    * @return a specific validator for the class described by this
594    *         ClassDescriptor.
595    */
596   public org.exolab.castor.xml.TypeValidator getValidator()
597   {
598     return this;
599   }
600
601   /**
602    * Method getXMLName.
603    * 
604    * @return the XML Name for the Class being described.
605    */
606   public java.lang.String getXMLName()
607   {
608     return _xmlName;
609   }
610
611   /**
612    * Method isElementDefinition.
613    * 
614    * @return true if XML schema definition of this Class is that of a global
615    *         element or element with anonymous type definition.
616    */
617   public boolean isElementDefinition()
618   {
619     return _elementDefinition;
620   }
621
622 }