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