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