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