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