627ecdedff52d5fb15862525ff3e7da3bdc758f3
[jalview.git] / src / jalview / schemabinding / version2 / descriptors / AnnotationColoursDescriptor.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
20 package jalview.schemabinding.version2.descriptors;
21
22   //---------------------------------/
23  //- Imported classes and packages -/
24 //---------------------------------/
25
26 import jalview.schemabinding.version2.AnnotationColours;
27
28 /**
29  * Class AnnotationColoursDescriptor.
30  * 
31  * @version $Revision$ $Date$
32  */
33 public class AnnotationColoursDescriptor extends 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       //----------------/
62      //- Constructors -/
63     //----------------/
64
65     public AnnotationColoursDescriptor() {
66         super();
67         _nsURI = "www.jalview.org";
68         _xmlName = "AnnotationColours";
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         //-- _aboveThreshold
76         desc = new org.exolab.castor.xml.util.XMLFieldDescriptorImpl(java.lang.Integer.TYPE, "_aboveThreshold", "aboveThreshold", org.exolab.castor.xml.NodeType.Attribute);
77         handler = new org.exolab.castor.xml.XMLFieldHandler() {
78             public java.lang.Object getValue( java.lang.Object object ) 
79                 throws IllegalStateException
80             {
81                 AnnotationColours target = (AnnotationColours) object;
82                 if (!target.hasAboveThreshold()) { return null; }
83                 return new java.lang.Integer(target.getAboveThreshold());
84             }
85             public void setValue( java.lang.Object object, java.lang.Object value) 
86                 throws IllegalStateException, IllegalArgumentException
87             {
88                 try {
89                     AnnotationColours target = (AnnotationColours) object;
90                     // if null, use delete method for optional primitives 
91                     if (value == null) {
92                         target.deleteAboveThreshold();
93                         return;
94                     }
95                     target.setAboveThreshold( ((java.lang.Integer) value).intValue());
96                 } catch (java.lang.Exception ex) {
97                     throw new IllegalStateException(ex.toString());
98                 }
99             }
100             public java.lang.Object newInstance(java.lang.Object parent) {
101                 return null;
102             }
103         };
104         desc.setHandler(handler);
105         desc.setMultivalued(false);
106         addFieldDescriptor(desc);
107         
108         //-- validation code for: _aboveThreshold
109         fieldValidator = new org.exolab.castor.xml.FieldValidator();
110         { //-- local scope
111             org.exolab.castor.xml.validators.IntValidator typeValidator;
112             typeValidator = new org.exolab.castor.xml.validators.IntValidator();
113             fieldValidator.setValidator(typeValidator);
114             typeValidator.setMinInclusive(-2147483648);
115             typeValidator.setMaxInclusive(2147483647);
116         }
117         desc.setValidator(fieldValidator);
118         //-- _annotation
119         desc = new org.exolab.castor.xml.util.XMLFieldDescriptorImpl(java.lang.String.class, "_annotation", "annotation", org.exolab.castor.xml.NodeType.Attribute);
120         desc.setImmutable(true);
121         handler = new org.exolab.castor.xml.XMLFieldHandler() {
122             public java.lang.Object getValue( java.lang.Object object ) 
123                 throws IllegalStateException
124             {
125                 AnnotationColours target = (AnnotationColours) object;
126                 return target.getAnnotation();
127             }
128             public void setValue( java.lang.Object object, java.lang.Object value) 
129                 throws IllegalStateException, IllegalArgumentException
130             {
131                 try {
132                     AnnotationColours target = (AnnotationColours) object;
133                     target.setAnnotation( (java.lang.String) value);
134                 } catch (java.lang.Exception ex) {
135                     throw new IllegalStateException(ex.toString());
136                 }
137             }
138             public java.lang.Object newInstance(java.lang.Object parent) {
139                 return null;
140             }
141         };
142         desc.setHandler(handler);
143         desc.setMultivalued(false);
144         addFieldDescriptor(desc);
145         
146         //-- validation code for: _annotation
147         fieldValidator = new org.exolab.castor.xml.FieldValidator();
148         { //-- local scope
149             org.exolab.castor.xml.validators.StringValidator typeValidator;
150             typeValidator = new org.exolab.castor.xml.validators.StringValidator();
151             fieldValidator.setValidator(typeValidator);
152             typeValidator.setWhiteSpace("preserve");
153         }
154         desc.setValidator(fieldValidator);
155         //-- _minColour
156         desc = new org.exolab.castor.xml.util.XMLFieldDescriptorImpl(java.lang.Integer.TYPE, "_minColour", "minColour", org.exolab.castor.xml.NodeType.Attribute);
157         handler = new org.exolab.castor.xml.XMLFieldHandler() {
158             public java.lang.Object getValue( java.lang.Object object ) 
159                 throws IllegalStateException
160             {
161                 AnnotationColours target = (AnnotationColours) object;
162                 if (!target.hasMinColour()) { return null; }
163                 return new java.lang.Integer(target.getMinColour());
164             }
165             public void setValue( java.lang.Object object, java.lang.Object value) 
166                 throws IllegalStateException, IllegalArgumentException
167             {
168                 try {
169                     AnnotationColours target = (AnnotationColours) object;
170                     // if null, use delete method for optional primitives 
171                     if (value == null) {
172                         target.deleteMinColour();
173                         return;
174                     }
175                     target.setMinColour( ((java.lang.Integer) value).intValue());
176                 } catch (java.lang.Exception ex) {
177                     throw new IllegalStateException(ex.toString());
178                 }
179             }
180             public java.lang.Object newInstance(java.lang.Object parent) {
181                 return null;
182             }
183         };
184         desc.setHandler(handler);
185         desc.setMultivalued(false);
186         addFieldDescriptor(desc);
187         
188         //-- validation code for: _minColour
189         fieldValidator = new org.exolab.castor.xml.FieldValidator();
190         { //-- local scope
191             org.exolab.castor.xml.validators.IntValidator typeValidator;
192             typeValidator = new org.exolab.castor.xml.validators.IntValidator();
193             fieldValidator.setValidator(typeValidator);
194             typeValidator.setMinInclusive(-2147483648);
195             typeValidator.setMaxInclusive(2147483647);
196         }
197         desc.setValidator(fieldValidator);
198         //-- _maxColour
199         desc = new org.exolab.castor.xml.util.XMLFieldDescriptorImpl(java.lang.Integer.TYPE, "_maxColour", "maxColour", org.exolab.castor.xml.NodeType.Attribute);
200         handler = new org.exolab.castor.xml.XMLFieldHandler() {
201             public java.lang.Object getValue( java.lang.Object object ) 
202                 throws IllegalStateException
203             {
204                 AnnotationColours target = (AnnotationColours) object;
205                 if (!target.hasMaxColour()) { return null; }
206                 return new java.lang.Integer(target.getMaxColour());
207             }
208             public void setValue( java.lang.Object object, java.lang.Object value) 
209                 throws IllegalStateException, IllegalArgumentException
210             {
211                 try {
212                     AnnotationColours target = (AnnotationColours) object;
213                     // if null, use delete method for optional primitives 
214                     if (value == null) {
215                         target.deleteMaxColour();
216                         return;
217                     }
218                     target.setMaxColour( ((java.lang.Integer) value).intValue());
219                 } catch (java.lang.Exception ex) {
220                     throw new IllegalStateException(ex.toString());
221                 }
222             }
223             public java.lang.Object newInstance(java.lang.Object parent) {
224                 return null;
225             }
226         };
227         desc.setHandler(handler);
228         desc.setMultivalued(false);
229         addFieldDescriptor(desc);
230         
231         //-- validation code for: _maxColour
232         fieldValidator = new org.exolab.castor.xml.FieldValidator();
233         { //-- local scope
234             org.exolab.castor.xml.validators.IntValidator typeValidator;
235             typeValidator = new org.exolab.castor.xml.validators.IntValidator();
236             fieldValidator.setValidator(typeValidator);
237             typeValidator.setMinInclusive(-2147483648);
238             typeValidator.setMaxInclusive(2147483647);
239         }
240         desc.setValidator(fieldValidator);
241         //-- _colourScheme
242         desc = new org.exolab.castor.xml.util.XMLFieldDescriptorImpl(java.lang.String.class, "_colourScheme", "colourScheme", org.exolab.castor.xml.NodeType.Attribute);
243         desc.setImmutable(true);
244         handler = new org.exolab.castor.xml.XMLFieldHandler() {
245             public java.lang.Object getValue( java.lang.Object object ) 
246                 throws IllegalStateException
247             {
248                 AnnotationColours target = (AnnotationColours) object;
249                 return target.getColourScheme();
250             }
251             public void setValue( java.lang.Object object, java.lang.Object value) 
252                 throws IllegalStateException, IllegalArgumentException
253             {
254                 try {
255                     AnnotationColours target = (AnnotationColours) object;
256                     target.setColourScheme( (java.lang.String) value);
257                 } catch (java.lang.Exception ex) {
258                     throw new IllegalStateException(ex.toString());
259                 }
260             }
261             public java.lang.Object newInstance(java.lang.Object parent) {
262                 return null;
263             }
264         };
265         desc.setHandler(handler);
266         desc.setMultivalued(false);
267         addFieldDescriptor(desc);
268         
269         //-- validation code for: _colourScheme
270         fieldValidator = new org.exolab.castor.xml.FieldValidator();
271         { //-- local scope
272             org.exolab.castor.xml.validators.StringValidator typeValidator;
273             typeValidator = new org.exolab.castor.xml.validators.StringValidator();
274             fieldValidator.setValidator(typeValidator);
275             typeValidator.setWhiteSpace("preserve");
276         }
277         desc.setValidator(fieldValidator);
278         //-- _threshold
279         desc = new org.exolab.castor.xml.util.XMLFieldDescriptorImpl(java.lang.Float.TYPE, "_threshold", "threshold", org.exolab.castor.xml.NodeType.Attribute);
280         handler = new org.exolab.castor.xml.XMLFieldHandler() {
281             public java.lang.Object getValue( java.lang.Object object ) 
282                 throws IllegalStateException
283             {
284                 AnnotationColours target = (AnnotationColours) object;
285                 if (!target.hasThreshold()) { return null; }
286                 return new java.lang.Float(target.getThreshold());
287             }
288             public void setValue( java.lang.Object object, java.lang.Object value) 
289                 throws IllegalStateException, IllegalArgumentException
290             {
291                 try {
292                     AnnotationColours target = (AnnotationColours) object;
293                     // if null, use delete method for optional primitives 
294                     if (value == null) {
295                         target.deleteThreshold();
296                         return;
297                     }
298                     target.setThreshold( ((java.lang.Float) value).floatValue());
299                 } catch (java.lang.Exception ex) {
300                     throw new IllegalStateException(ex.toString());
301                 }
302             }
303             public java.lang.Object newInstance(java.lang.Object parent) {
304                 return null;
305             }
306         };
307         desc.setHandler(handler);
308         desc.setMultivalued(false);
309         addFieldDescriptor(desc);
310         
311         //-- validation code for: _threshold
312         fieldValidator = new org.exolab.castor.xml.FieldValidator();
313         { //-- local scope
314             org.exolab.castor.xml.validators.FloatValidator typeValidator;
315             typeValidator = new org.exolab.castor.xml.validators.FloatValidator();
316             fieldValidator.setValidator(typeValidator);
317             typeValidator.setMinInclusive((float) -3.4028235E38);
318             typeValidator.setMaxInclusive((float) 3.4028235E38);
319         }
320         desc.setValidator(fieldValidator);
321         //-- _perSequence
322         desc = new org.exolab.castor.xml.util.XMLFieldDescriptorImpl(java.lang.Boolean.TYPE, "_perSequence", "perSequence", org.exolab.castor.xml.NodeType.Attribute);
323         handler = new org.exolab.castor.xml.XMLFieldHandler() {
324             public java.lang.Object getValue( java.lang.Object object ) 
325                 throws IllegalStateException
326             {
327                 AnnotationColours target = (AnnotationColours) object;
328                 if (!target.hasPerSequence()) { return null; }
329                 return (target.getPerSequence() ? java.lang.Boolean.TRUE : java.lang.Boolean.FALSE);
330             }
331             public void setValue( java.lang.Object object, java.lang.Object value) 
332                 throws IllegalStateException, IllegalArgumentException
333             {
334                 try {
335                     AnnotationColours target = (AnnotationColours) object;
336                     // if null, use delete method for optional primitives 
337                     if (value == null) {
338                         target.deletePerSequence();
339                         return;
340                     }
341                     target.setPerSequence( ((java.lang.Boolean) value).booleanValue());
342                 } catch (java.lang.Exception ex) {
343                     throw new IllegalStateException(ex.toString());
344                 }
345             }
346             public java.lang.Object newInstance(java.lang.Object parent) {
347                 return null;
348             }
349         };
350         desc.setHandler(handler);
351         desc.setMultivalued(false);
352         addFieldDescriptor(desc);
353         
354         //-- validation code for: _perSequence
355         fieldValidator = new org.exolab.castor.xml.FieldValidator();
356         { //-- local scope
357             org.exolab.castor.xml.validators.BooleanValidator typeValidator;
358             typeValidator = new org.exolab.castor.xml.validators.BooleanValidator();
359             fieldValidator.setValidator(typeValidator);
360         }
361         desc.setValidator(fieldValidator);
362         //-- _predefinedColours
363         desc = new org.exolab.castor.xml.util.XMLFieldDescriptorImpl(java.lang.Boolean.TYPE, "_predefinedColours", "predefinedColours", org.exolab.castor.xml.NodeType.Attribute);
364         handler = new org.exolab.castor.xml.XMLFieldHandler() {
365             public java.lang.Object getValue( java.lang.Object object ) 
366                 throws IllegalStateException
367             {
368                 AnnotationColours target = (AnnotationColours) object;
369                 if (!target.hasPredefinedColours()) { return null; }
370                 return (target.getPredefinedColours() ? java.lang.Boolean.TRUE : java.lang.Boolean.FALSE);
371             }
372             public void setValue( java.lang.Object object, java.lang.Object value) 
373                 throws IllegalStateException, IllegalArgumentException
374             {
375                 try {
376                     AnnotationColours target = (AnnotationColours) object;
377                     // if null, use delete method for optional primitives 
378                     if (value == null) {
379                         target.deletePredefinedColours();
380                         return;
381                     }
382                     target.setPredefinedColours( ((java.lang.Boolean) value).booleanValue());
383                 } catch (java.lang.Exception ex) {
384                     throw new IllegalStateException(ex.toString());
385                 }
386             }
387             public java.lang.Object newInstance(java.lang.Object parent) {
388                 return null;
389             }
390         };
391         desc.setHandler(handler);
392         desc.setMultivalued(false);
393         addFieldDescriptor(desc);
394         
395         //-- validation code for: _predefinedColours
396         fieldValidator = new org.exolab.castor.xml.FieldValidator();
397         { //-- local scope
398             org.exolab.castor.xml.validators.BooleanValidator typeValidator;
399             typeValidator = new org.exolab.castor.xml.validators.BooleanValidator();
400             fieldValidator.setValidator(typeValidator);
401         }
402         desc.setValidator(fieldValidator);
403         //-- initialize element descriptors
404         
405     }
406
407
408       //-----------/
409      //- Methods -/
410     //-----------/
411
412     /**
413      * Method getAccessMode.
414      * 
415      * @return the access mode specified for this class.
416      */
417     public org.exolab.castor.mapping.AccessMode getAccessMode(
418     ) {
419         return null;
420     }
421
422     /**
423      * Method getIdentity.
424      * 
425      * @return the identity field, null if this class has no
426      * identity.
427      */
428     public org.exolab.castor.mapping.FieldDescriptor getIdentity(
429     ) {
430         return super.getIdentity();
431     }
432
433     /**
434      * Method getJavaClass.
435      * 
436      * @return the Java class represented by this descriptor.
437      */
438     public java.lang.Class getJavaClass(
439     ) {
440         return jalview.schemabinding.version2.AnnotationColours.class;
441     }
442
443     /**
444      * Method getNameSpacePrefix.
445      * 
446      * @return the namespace prefix to use when marshaling as XML.
447      */
448     public java.lang.String getNameSpacePrefix(
449     ) {
450         return _nsPrefix;
451     }
452
453     /**
454      * Method getNameSpaceURI.
455      * 
456      * @return the namespace URI used when marshaling and
457      * unmarshaling as XML.
458      */
459     public java.lang.String getNameSpaceURI(
460     ) {
461         return _nsURI;
462     }
463
464     /**
465      * Method getValidator.
466      * 
467      * @return a specific validator for the class described by this
468      * ClassDescriptor.
469      */
470     public org.exolab.castor.xml.TypeValidator getValidator(
471     ) {
472         return this;
473     }
474
475     /**
476      * Method getXMLName.
477      * 
478      * @return the XML Name for the Class being described.
479      */
480     public java.lang.String getXMLName(
481     ) {
482         return _xmlName;
483     }
484
485     /**
486      * Method isElementDefinition.
487      * 
488      * @return true if XML schema definition of this Class is that
489      * of a global
490      * element or element with anonymous type definition.
491      */
492     public boolean isElementDefinition(
493     ) {
494         return _elementDefinition;
495     }
496
497 }