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