JAL-1503 update version in GPL header
[jalview.git] / src / jalview / schemabinding / version2 / descriptors / SettingDescriptor.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.Setting;
34
35 /**
36  * Class SettingDescriptor.
37  * 
38  * @version $Revision$ $Date$
39  */
40 public class SettingDescriptor 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 SettingDescriptor()
73   {
74     super();
75     _nsURI = "www.jalview.org";
76     _xmlName = "setting";
77     _elementDefinition = true;
78     org.exolab.castor.xml.util.XMLFieldDescriptorImpl desc = null;
79     org.exolab.castor.mapping.FieldHandler handler = null;
80     org.exolab.castor.xml.FieldValidator fieldValidator = null;
81     // -- initialize attribute descriptors
82
83     // -- _type
84     desc = new org.exolab.castor.xml.util.XMLFieldDescriptorImpl(
85             java.lang.String.class, "_type", "type",
86             org.exolab.castor.xml.NodeType.Attribute);
87     desc.setImmutable(true);
88     handler = new org.exolab.castor.xml.XMLFieldHandler()
89     {
90       public java.lang.Object getValue(java.lang.Object object)
91               throws IllegalStateException
92       {
93         Setting target = (Setting) object;
94         return target.getType();
95       }
96
97       public void setValue(java.lang.Object object, java.lang.Object value)
98               throws IllegalStateException, IllegalArgumentException
99       {
100         try
101         {
102           Setting target = (Setting) object;
103           target.setType((java.lang.String) value);
104         } catch (java.lang.Exception ex)
105         {
106           throw new IllegalStateException(ex.toString());
107         }
108       }
109
110       public java.lang.Object newInstance(java.lang.Object parent)
111       {
112         return null;
113       }
114     };
115     desc.setHandler(handler);
116     desc.setRequired(true);
117     desc.setMultivalued(false);
118     addFieldDescriptor(desc);
119
120     // -- validation code for: _type
121     fieldValidator = new org.exolab.castor.xml.FieldValidator();
122     fieldValidator.setMinOccurs(1);
123     { // -- local scope
124       org.exolab.castor.xml.validators.StringValidator typeValidator;
125       typeValidator = new org.exolab.castor.xml.validators.StringValidator();
126       fieldValidator.setValidator(typeValidator);
127       typeValidator.setWhiteSpace("preserve");
128     }
129     desc.setValidator(fieldValidator);
130     // -- _colour
131     desc = new org.exolab.castor.xml.util.XMLFieldDescriptorImpl(
132             java.lang.Integer.TYPE, "_colour", "colour",
133             org.exolab.castor.xml.NodeType.Attribute);
134     handler = new org.exolab.castor.xml.XMLFieldHandler()
135     {
136       public java.lang.Object getValue(java.lang.Object object)
137               throws IllegalStateException
138       {
139         Setting target = (Setting) object;
140         if (!target.hasColour())
141         {
142           return null;
143         }
144         return new java.lang.Integer(target.getColour());
145       }
146
147       public void setValue(java.lang.Object object, java.lang.Object value)
148               throws IllegalStateException, IllegalArgumentException
149       {
150         try
151         {
152           Setting target = (Setting) object;
153           // ignore null values for non optional primitives
154           if (value == null)
155           {
156             return;
157           }
158
159           target.setColour(((java.lang.Integer) value).intValue());
160         } catch (java.lang.Exception ex)
161         {
162           throw new IllegalStateException(ex.toString());
163         }
164       }
165
166       public java.lang.Object newInstance(java.lang.Object parent)
167       {
168         return null;
169       }
170     };
171     desc.setHandler(handler);
172     desc.setRequired(true);
173     desc.setMultivalued(false);
174     addFieldDescriptor(desc);
175
176     // -- validation code for: _colour
177     fieldValidator = new org.exolab.castor.xml.FieldValidator();
178     fieldValidator.setMinOccurs(1);
179     { // -- local scope
180       org.exolab.castor.xml.validators.IntValidator typeValidator;
181       typeValidator = new org.exolab.castor.xml.validators.IntValidator();
182       fieldValidator.setValidator(typeValidator);
183       typeValidator.setMinInclusive(-2147483648);
184       typeValidator.setMaxInclusive(2147483647);
185     }
186     desc.setValidator(fieldValidator);
187     // -- _display
188     desc = new org.exolab.castor.xml.util.XMLFieldDescriptorImpl(
189             java.lang.Boolean.TYPE, "_display", "display",
190             org.exolab.castor.xml.NodeType.Attribute);
191     handler = new org.exolab.castor.xml.XMLFieldHandler()
192     {
193       public java.lang.Object getValue(java.lang.Object object)
194               throws IllegalStateException
195       {
196         Setting target = (Setting) object;
197         if (!target.hasDisplay())
198         {
199           return null;
200         }
201         return (target.getDisplay() ? java.lang.Boolean.TRUE
202                 : java.lang.Boolean.FALSE);
203       }
204
205       public void setValue(java.lang.Object object, java.lang.Object value)
206               throws IllegalStateException, IllegalArgumentException
207       {
208         try
209         {
210           Setting target = (Setting) object;
211           // ignore null values for non optional primitives
212           if (value == null)
213           {
214             return;
215           }
216
217           target.setDisplay(((java.lang.Boolean) value).booleanValue());
218         } catch (java.lang.Exception ex)
219         {
220           throw new IllegalStateException(ex.toString());
221         }
222       }
223
224       public java.lang.Object newInstance(java.lang.Object parent)
225       {
226         return null;
227       }
228     };
229     desc.setHandler(handler);
230     desc.setRequired(true);
231     desc.setMultivalued(false);
232     addFieldDescriptor(desc);
233
234     // -- validation code for: _display
235     fieldValidator = new org.exolab.castor.xml.FieldValidator();
236     fieldValidator.setMinOccurs(1);
237     { // -- local scope
238       org.exolab.castor.xml.validators.BooleanValidator typeValidator;
239       typeValidator = new org.exolab.castor.xml.validators.BooleanValidator();
240       fieldValidator.setValidator(typeValidator);
241     }
242     desc.setValidator(fieldValidator);
243     // -- _order
244     desc = new org.exolab.castor.xml.util.XMLFieldDescriptorImpl(
245             java.lang.Float.TYPE, "_order", "order",
246             org.exolab.castor.xml.NodeType.Attribute);
247     handler = new org.exolab.castor.xml.XMLFieldHandler()
248     {
249       public java.lang.Object getValue(java.lang.Object object)
250               throws IllegalStateException
251       {
252         Setting target = (Setting) object;
253         if (!target.hasOrder())
254         {
255           return null;
256         }
257         return new java.lang.Float(target.getOrder());
258       }
259
260       public void setValue(java.lang.Object object, java.lang.Object value)
261               throws IllegalStateException, IllegalArgumentException
262       {
263         try
264         {
265           Setting target = (Setting) object;
266           // if null, use delete method for optional primitives
267           if (value == null)
268           {
269             target.deleteOrder();
270             return;
271           }
272           target.setOrder(((java.lang.Float) value).floatValue());
273         } catch (java.lang.Exception ex)
274         {
275           throw new IllegalStateException(ex.toString());
276         }
277       }
278
279       public java.lang.Object newInstance(java.lang.Object parent)
280       {
281         return null;
282       }
283     };
284     desc.setHandler(handler);
285     desc.setMultivalued(false);
286     addFieldDescriptor(desc);
287
288     // -- validation code for: _order
289     fieldValidator = new org.exolab.castor.xml.FieldValidator();
290     { // -- local scope
291       org.exolab.castor.xml.validators.FloatValidator typeValidator;
292       typeValidator = new org.exolab.castor.xml.validators.FloatValidator();
293       fieldValidator.setValidator(typeValidator);
294       typeValidator.setMinInclusive((float) -3.4028235E38);
295       typeValidator.setMaxInclusive((float) 3.4028235E38);
296     }
297     desc.setValidator(fieldValidator);
298     // -- _mincolour
299     desc = new org.exolab.castor.xml.util.XMLFieldDescriptorImpl(
300             java.lang.Integer.TYPE, "_mincolour", "mincolour",
301             org.exolab.castor.xml.NodeType.Attribute);
302     handler = new org.exolab.castor.xml.XMLFieldHandler()
303     {
304       public java.lang.Object getValue(java.lang.Object object)
305               throws IllegalStateException
306       {
307         Setting target = (Setting) object;
308         if (!target.hasMincolour())
309         {
310           return null;
311         }
312         return new java.lang.Integer(target.getMincolour());
313       }
314
315       public void setValue(java.lang.Object object, java.lang.Object value)
316               throws IllegalStateException, IllegalArgumentException
317       {
318         try
319         {
320           Setting target = (Setting) object;
321           // if null, use delete method for optional primitives
322           if (value == null)
323           {
324             target.deleteMincolour();
325             return;
326           }
327           target.setMincolour(((java.lang.Integer) value).intValue());
328         } catch (java.lang.Exception ex)
329         {
330           throw new IllegalStateException(ex.toString());
331         }
332       }
333
334       public java.lang.Object newInstance(java.lang.Object parent)
335       {
336         return null;
337       }
338     };
339     desc.setHandler(handler);
340     desc.setMultivalued(false);
341     addFieldDescriptor(desc);
342
343     // -- validation code for: _mincolour
344     fieldValidator = new org.exolab.castor.xml.FieldValidator();
345     { // -- local scope
346       org.exolab.castor.xml.validators.IntValidator typeValidator;
347       typeValidator = new org.exolab.castor.xml.validators.IntValidator();
348       fieldValidator.setValidator(typeValidator);
349       typeValidator.setMinInclusive(-2147483648);
350       typeValidator.setMaxInclusive(2147483647);
351     }
352     desc.setValidator(fieldValidator);
353     // -- _threshold
354     desc = new org.exolab.castor.xml.util.XMLFieldDescriptorImpl(
355             java.lang.Float.TYPE, "_threshold", "threshold",
356             org.exolab.castor.xml.NodeType.Attribute);
357     handler = new org.exolab.castor.xml.XMLFieldHandler()
358     {
359       public java.lang.Object getValue(java.lang.Object object)
360               throws IllegalStateException
361       {
362         Setting target = (Setting) object;
363         if (!target.hasThreshold())
364         {
365           return null;
366         }
367         return new java.lang.Float(target.getThreshold());
368       }
369
370       public void setValue(java.lang.Object object, java.lang.Object value)
371               throws IllegalStateException, IllegalArgumentException
372       {
373         try
374         {
375           Setting target = (Setting) object;
376           // if null, use delete method for optional primitives
377           if (value == null)
378           {
379             target.deleteThreshold();
380             return;
381           }
382           target.setThreshold(((java.lang.Float) value).floatValue());
383         } catch (java.lang.Exception ex)
384         {
385           throw new IllegalStateException(ex.toString());
386         }
387       }
388
389       public java.lang.Object newInstance(java.lang.Object parent)
390       {
391         return null;
392       }
393     };
394     desc.setHandler(handler);
395     desc.setMultivalued(false);
396     addFieldDescriptor(desc);
397
398     // -- validation code for: _threshold
399     fieldValidator = new org.exolab.castor.xml.FieldValidator();
400     { // -- local scope
401       org.exolab.castor.xml.validators.FloatValidator typeValidator;
402       typeValidator = new org.exolab.castor.xml.validators.FloatValidator();
403       fieldValidator.setValidator(typeValidator);
404       typeValidator.setMinInclusive((float) -3.4028235E38);
405       typeValidator.setMaxInclusive((float) 3.4028235E38);
406     }
407     desc.setValidator(fieldValidator);
408     // -- _threshstate
409     desc = new org.exolab.castor.xml.util.XMLFieldDescriptorImpl(
410             java.lang.Integer.TYPE, "_threshstate", "threshstate",
411             org.exolab.castor.xml.NodeType.Attribute);
412     handler = new org.exolab.castor.xml.XMLFieldHandler()
413     {
414       public java.lang.Object getValue(java.lang.Object object)
415               throws IllegalStateException
416       {
417         Setting target = (Setting) object;
418         if (!target.hasThreshstate())
419         {
420           return null;
421         }
422         return new java.lang.Integer(target.getThreshstate());
423       }
424
425       public void setValue(java.lang.Object object, java.lang.Object value)
426               throws IllegalStateException, IllegalArgumentException
427       {
428         try
429         {
430           Setting target = (Setting) object;
431           // if null, use delete method for optional primitives
432           if (value == null)
433           {
434             target.deleteThreshstate();
435             return;
436           }
437           target.setThreshstate(((java.lang.Integer) value).intValue());
438         } catch (java.lang.Exception ex)
439         {
440           throw new IllegalStateException(ex.toString());
441         }
442       }
443
444       public java.lang.Object newInstance(java.lang.Object parent)
445       {
446         return null;
447       }
448     };
449     desc.setHandler(handler);
450     desc.setMultivalued(false);
451     addFieldDescriptor(desc);
452
453     // -- validation code for: _threshstate
454     fieldValidator = new org.exolab.castor.xml.FieldValidator();
455     { // -- local scope
456       org.exolab.castor.xml.validators.IntValidator typeValidator;
457       typeValidator = new org.exolab.castor.xml.validators.IntValidator();
458       fieldValidator.setValidator(typeValidator);
459       typeValidator.setMinInclusive(-2147483648);
460       typeValidator.setMaxInclusive(2147483647);
461     }
462     desc.setValidator(fieldValidator);
463     // -- _max
464     desc = new org.exolab.castor.xml.util.XMLFieldDescriptorImpl(
465             java.lang.Float.TYPE, "_max", "max",
466             org.exolab.castor.xml.NodeType.Attribute);
467     handler = new org.exolab.castor.xml.XMLFieldHandler()
468     {
469       public java.lang.Object getValue(java.lang.Object object)
470               throws IllegalStateException
471       {
472         Setting target = (Setting) object;
473         if (!target.hasMax())
474         {
475           return null;
476         }
477         return new java.lang.Float(target.getMax());
478       }
479
480       public void setValue(java.lang.Object object, java.lang.Object value)
481               throws IllegalStateException, IllegalArgumentException
482       {
483         try
484         {
485           Setting target = (Setting) object;
486           // if null, use delete method for optional primitives
487           if (value == null)
488           {
489             target.deleteMax();
490             return;
491           }
492           target.setMax(((java.lang.Float) value).floatValue());
493         } catch (java.lang.Exception ex)
494         {
495           throw new IllegalStateException(ex.toString());
496         }
497       }
498
499       public java.lang.Object newInstance(java.lang.Object parent)
500       {
501         return null;
502       }
503     };
504     desc.setHandler(handler);
505     desc.setMultivalued(false);
506     addFieldDescriptor(desc);
507
508     // -- validation code for: _max
509     fieldValidator = new org.exolab.castor.xml.FieldValidator();
510     { // -- local scope
511       org.exolab.castor.xml.validators.FloatValidator typeValidator;
512       typeValidator = new org.exolab.castor.xml.validators.FloatValidator();
513       fieldValidator.setValidator(typeValidator);
514       typeValidator.setMinInclusive((float) -3.4028235E38);
515       typeValidator.setMaxInclusive((float) 3.4028235E38);
516     }
517     desc.setValidator(fieldValidator);
518     // -- _min
519     desc = new org.exolab.castor.xml.util.XMLFieldDescriptorImpl(
520             java.lang.Float.TYPE, "_min", "min",
521             org.exolab.castor.xml.NodeType.Attribute);
522     handler = new org.exolab.castor.xml.XMLFieldHandler()
523     {
524       public java.lang.Object getValue(java.lang.Object object)
525               throws IllegalStateException
526       {
527         Setting target = (Setting) object;
528         if (!target.hasMin())
529         {
530           return null;
531         }
532         return new java.lang.Float(target.getMin());
533       }
534
535       public void setValue(java.lang.Object object, java.lang.Object value)
536               throws IllegalStateException, IllegalArgumentException
537       {
538         try
539         {
540           Setting target = (Setting) object;
541           // if null, use delete method for optional primitives
542           if (value == null)
543           {
544             target.deleteMin();
545             return;
546           }
547           target.setMin(((java.lang.Float) value).floatValue());
548         } catch (java.lang.Exception ex)
549         {
550           throw new IllegalStateException(ex.toString());
551         }
552       }
553
554       public java.lang.Object newInstance(java.lang.Object parent)
555       {
556         return null;
557       }
558     };
559     desc.setHandler(handler);
560     desc.setMultivalued(false);
561     addFieldDescriptor(desc);
562
563     // -- validation code for: _min
564     fieldValidator = new org.exolab.castor.xml.FieldValidator();
565     { // -- local scope
566       org.exolab.castor.xml.validators.FloatValidator typeValidator;
567       typeValidator = new org.exolab.castor.xml.validators.FloatValidator();
568       fieldValidator.setValidator(typeValidator);
569       typeValidator.setMinInclusive((float) -3.4028235E38);
570       typeValidator.setMaxInclusive((float) 3.4028235E38);
571     }
572     desc.setValidator(fieldValidator);
573     // -- _colourByLabel
574     desc = new org.exolab.castor.xml.util.XMLFieldDescriptorImpl(
575             java.lang.Boolean.TYPE, "_colourByLabel", "colourByLabel",
576             org.exolab.castor.xml.NodeType.Attribute);
577     handler = new org.exolab.castor.xml.XMLFieldHandler()
578     {
579       public java.lang.Object getValue(java.lang.Object object)
580               throws IllegalStateException
581       {
582         Setting target = (Setting) object;
583         if (!target.hasColourByLabel())
584         {
585           return null;
586         }
587         return (target.getColourByLabel() ? java.lang.Boolean.TRUE
588                 : java.lang.Boolean.FALSE);
589       }
590
591       public void setValue(java.lang.Object object, java.lang.Object value)
592               throws IllegalStateException, IllegalArgumentException
593       {
594         try
595         {
596           Setting target = (Setting) object;
597           // if null, use delete method for optional primitives
598           if (value == null)
599           {
600             target.deleteColourByLabel();
601             return;
602           }
603           target.setColourByLabel(((java.lang.Boolean) value)
604                   .booleanValue());
605         } catch (java.lang.Exception ex)
606         {
607           throw new IllegalStateException(ex.toString());
608         }
609       }
610
611       public java.lang.Object newInstance(java.lang.Object parent)
612       {
613         return null;
614       }
615     };
616     desc.setHandler(handler);
617     desc.setMultivalued(false);
618     addFieldDescriptor(desc);
619
620     // -- validation code for: _colourByLabel
621     fieldValidator = new org.exolab.castor.xml.FieldValidator();
622     { // -- local scope
623       org.exolab.castor.xml.validators.BooleanValidator typeValidator;
624       typeValidator = new org.exolab.castor.xml.validators.BooleanValidator();
625       fieldValidator.setValidator(typeValidator);
626     }
627     desc.setValidator(fieldValidator);
628     // -- _autoScale
629     desc = new org.exolab.castor.xml.util.XMLFieldDescriptorImpl(
630             java.lang.Boolean.TYPE, "_autoScale", "autoScale",
631             org.exolab.castor.xml.NodeType.Attribute);
632     handler = new org.exolab.castor.xml.XMLFieldHandler()
633     {
634       public java.lang.Object getValue(java.lang.Object object)
635               throws IllegalStateException
636       {
637         Setting target = (Setting) object;
638         if (!target.hasAutoScale())
639         {
640           return null;
641         }
642         return (target.getAutoScale() ? java.lang.Boolean.TRUE
643                 : java.lang.Boolean.FALSE);
644       }
645
646       public void setValue(java.lang.Object object, java.lang.Object value)
647               throws IllegalStateException, IllegalArgumentException
648       {
649         try
650         {
651           Setting target = (Setting) object;
652           // if null, use delete method for optional primitives
653           if (value == null)
654           {
655             target.deleteAutoScale();
656             return;
657           }
658           target.setAutoScale(((java.lang.Boolean) value).booleanValue());
659         } catch (java.lang.Exception ex)
660         {
661           throw new IllegalStateException(ex.toString());
662         }
663       }
664
665       public java.lang.Object newInstance(java.lang.Object parent)
666       {
667         return null;
668       }
669     };
670     desc.setHandler(handler);
671     desc.setMultivalued(false);
672     addFieldDescriptor(desc);
673
674     // -- validation code for: _autoScale
675     fieldValidator = new org.exolab.castor.xml.FieldValidator();
676     { // -- local scope
677       org.exolab.castor.xml.validators.BooleanValidator typeValidator;
678       typeValidator = new org.exolab.castor.xml.validators.BooleanValidator();
679       fieldValidator.setValidator(typeValidator);
680     }
681     desc.setValidator(fieldValidator);
682     // -- initialize element descriptors
683
684   }
685
686   // -----------/
687   // - Methods -/
688   // -----------/
689
690   /**
691    * Method getAccessMode.
692    * 
693    * @return the access mode specified for this class.
694    */
695   public org.exolab.castor.mapping.AccessMode getAccessMode()
696   {
697     return null;
698   }
699
700   /**
701    * Method getIdentity.
702    * 
703    * @return the identity field, null if this class has no identity.
704    */
705   public org.exolab.castor.mapping.FieldDescriptor getIdentity()
706   {
707     return super.getIdentity();
708   }
709
710   /**
711    * Method getJavaClass.
712    * 
713    * @return the Java class represented by this descriptor.
714    */
715   public java.lang.Class getJavaClass()
716   {
717     return jalview.schemabinding.version2.Setting.class;
718   }
719
720   /**
721    * Method getNameSpacePrefix.
722    * 
723    * @return the namespace prefix to use when marshaling as XML.
724    */
725   public java.lang.String getNameSpacePrefix()
726   {
727     return _nsPrefix;
728   }
729
730   /**
731    * Method getNameSpaceURI.
732    * 
733    * @return the namespace URI used when marshaling and unmarshaling as XML.
734    */
735   public java.lang.String getNameSpaceURI()
736   {
737     return _nsURI;
738   }
739
740   /**
741    * Method getValidator.
742    * 
743    * @return a specific validator for the class described by this
744    *         ClassDescriptor.
745    */
746   public org.exolab.castor.xml.TypeValidator getValidator()
747   {
748     return this;
749   }
750
751   /**
752    * Method getXMLName.
753    * 
754    * @return the XML Name for the Class being described.
755    */
756   public java.lang.String getXMLName()
757   {
758     return _xmlName;
759   }
760
761   /**
762    * Method isElementDefinition.
763    * 
764    * @return true if XML schema definition of this Class is that of a global
765    *         element or element with anonymous type definition.
766    */
767   public boolean isElementDefinition()
768   {
769     return _elementDefinition;
770   }
771
772 }