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