JAL-1503 update version in GPL header
[jalview.git] / src / jalview / schemabinding / version2 / descriptors / AnnotationElementDescriptor.java
1 /*******************************************************************************
2  * Jalview - A Sequence Alignment Editor and Viewer (Version 2.8.1)
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.  
17  * If not, see <http://www.gnu.org/licenses/>.
18  * The Jalview Authors are detailed in the 'AUTHORS' file.
19  ******************************************************************************/
20 /*
21  * This class was automatically generated with 
22  * <a href="http://www.castor.org">Castor 1.1</a>, using an XML
23  * Schema.
24  * $Id$
25  */
26
27 package jalview.schemabinding.version2.descriptors;
28
29 //---------------------------------/
30 //- Imported classes and packages -/
31 //---------------------------------/
32
33 import jalview.schemabinding.version2.AnnotationElement;
34
35 /**
36  * Class AnnotationElementDescriptor.
37  * 
38  * @version $Revision$ $Date$
39  */
40 public class AnnotationElementDescriptor extends
41         org.exolab.castor.xml.util.XMLClassDescriptorImpl
42 {
43
44   // --------------------------/
45   // - Class/Member Variables -/
46   // --------------------------/
47
48   /**
49    * Field _elementDefinition.
50    */
51   private boolean _elementDefinition;
52
53   /**
54    * Field _nsPrefix.
55    */
56   private java.lang.String _nsPrefix;
57
58   /**
59    * Field _nsURI.
60    */
61   private java.lang.String _nsURI;
62
63   /**
64    * Field _xmlName.
65    */
66   private java.lang.String _xmlName;
67
68   // ----------------/
69   // - Constructors -/
70   // ----------------/
71
72   public AnnotationElementDescriptor()
73   {
74     super();
75     _nsURI = "www.vamsas.ac.uk/jalview/version2";
76     _xmlName = "annotationElement";
77     _elementDefinition = true;
78
79     // -- set grouping compositor
80     setCompositorAsSequence();
81     org.exolab.castor.xml.util.XMLFieldDescriptorImpl desc = null;
82     org.exolab.castor.mapping.FieldHandler handler = null;
83     org.exolab.castor.xml.FieldValidator fieldValidator = null;
84     // -- initialize attribute descriptors
85
86     // -- _position
87     desc = new org.exolab.castor.xml.util.XMLFieldDescriptorImpl(
88             java.lang.Integer.TYPE, "_position", "position",
89             org.exolab.castor.xml.NodeType.Attribute);
90     handler = new org.exolab.castor.xml.XMLFieldHandler()
91     {
92       public java.lang.Object getValue(java.lang.Object object)
93               throws IllegalStateException
94       {
95         AnnotationElement target = (AnnotationElement) object;
96         if (!target.hasPosition())
97         {
98           return null;
99         }
100         return new java.lang.Integer(target.getPosition());
101       }
102
103       public void setValue(java.lang.Object object, java.lang.Object value)
104               throws IllegalStateException, IllegalArgumentException
105       {
106         try
107         {
108           AnnotationElement target = (AnnotationElement) object;
109           // ignore null values for non optional primitives
110           if (value == null)
111           {
112             return;
113           }
114
115           target.setPosition(((java.lang.Integer) value).intValue());
116         } catch (java.lang.Exception ex)
117         {
118           throw new IllegalStateException(ex.toString());
119         }
120       }
121
122       public java.lang.Object newInstance(java.lang.Object parent)
123       {
124         return null;
125       }
126     };
127     desc.setHandler(handler);
128     desc.setRequired(true);
129     desc.setMultivalued(false);
130     addFieldDescriptor(desc);
131
132     // -- validation code for: _position
133     fieldValidator = new org.exolab.castor.xml.FieldValidator();
134     fieldValidator.setMinOccurs(1);
135     { // -- local scope
136       org.exolab.castor.xml.validators.IntValidator typeValidator;
137       typeValidator = new org.exolab.castor.xml.validators.IntValidator();
138       fieldValidator.setValidator(typeValidator);
139       typeValidator.setMinInclusive(-2147483648);
140       typeValidator.setMaxInclusive(2147483647);
141     }
142     desc.setValidator(fieldValidator);
143     // -- _colour
144     desc = new org.exolab.castor.xml.util.XMLFieldDescriptorImpl(
145             java.lang.Integer.TYPE, "_colour", "colour",
146             org.exolab.castor.xml.NodeType.Attribute);
147     handler = new org.exolab.castor.xml.XMLFieldHandler()
148     {
149       public java.lang.Object getValue(java.lang.Object object)
150               throws IllegalStateException
151       {
152         AnnotationElement target = (AnnotationElement) object;
153         if (!target.hasColour())
154         {
155           return null;
156         }
157         return new java.lang.Integer(target.getColour());
158       }
159
160       public void setValue(java.lang.Object object, java.lang.Object value)
161               throws IllegalStateException, IllegalArgumentException
162       {
163         try
164         {
165           AnnotationElement target = (AnnotationElement) object;
166           // if null, use delete method for optional primitives
167           if (value == null)
168           {
169             target.deleteColour();
170             return;
171           }
172           target.setColour(((java.lang.Integer) value).intValue());
173         } catch (java.lang.Exception ex)
174         {
175           throw new IllegalStateException(ex.toString());
176         }
177       }
178
179       public java.lang.Object newInstance(java.lang.Object parent)
180       {
181         return null;
182       }
183     };
184     desc.setHandler(handler);
185     desc.setMultivalued(false);
186     addFieldDescriptor(desc);
187
188     // -- validation code for: _colour
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     // -- initialize element descriptors
199
200     // -- _displayCharacter
201     desc = new org.exolab.castor.xml.util.XMLFieldDescriptorImpl(
202             java.lang.String.class, "_displayCharacter",
203             "displayCharacter", org.exolab.castor.xml.NodeType.Element);
204     desc.setImmutable(true);
205     handler = new org.exolab.castor.xml.XMLFieldHandler()
206     {
207       public java.lang.Object getValue(java.lang.Object object)
208               throws IllegalStateException
209       {
210         AnnotationElement target = (AnnotationElement) object;
211         return target.getDisplayCharacter();
212       }
213
214       public void setValue(java.lang.Object object, java.lang.Object value)
215               throws IllegalStateException, IllegalArgumentException
216       {
217         try
218         {
219           AnnotationElement target = (AnnotationElement) object;
220           target.setDisplayCharacter((java.lang.String) value);
221         } catch (java.lang.Exception ex)
222         {
223           throw new IllegalStateException(ex.toString());
224         }
225       }
226
227       public java.lang.Object newInstance(java.lang.Object parent)
228       {
229         return null;
230       }
231     };
232     desc.setHandler(handler);
233     desc.setNameSpaceURI("www.vamsas.ac.uk/jalview/version2");
234     desc.setMultivalued(false);
235     addFieldDescriptor(desc);
236
237     // -- validation code for: _displayCharacter
238     fieldValidator = new org.exolab.castor.xml.FieldValidator();
239     { // -- local scope
240       org.exolab.castor.xml.validators.StringValidator typeValidator;
241       typeValidator = new org.exolab.castor.xml.validators.StringValidator();
242       fieldValidator.setValidator(typeValidator);
243       typeValidator.setWhiteSpace("preserve");
244     }
245     desc.setValidator(fieldValidator);
246     // -- _description
247     desc = new org.exolab.castor.xml.util.XMLFieldDescriptorImpl(
248             java.lang.String.class, "_description", "description",
249             org.exolab.castor.xml.NodeType.Element);
250     desc.setImmutable(true);
251     handler = new org.exolab.castor.xml.XMLFieldHandler()
252     {
253       public java.lang.Object getValue(java.lang.Object object)
254               throws IllegalStateException
255       {
256         AnnotationElement target = (AnnotationElement) object;
257         return target.getDescription();
258       }
259
260       public void setValue(java.lang.Object object, java.lang.Object value)
261               throws IllegalStateException, IllegalArgumentException
262       {
263         try
264         {
265           AnnotationElement target = (AnnotationElement) object;
266           target.setDescription((java.lang.String) value);
267         } catch (java.lang.Exception ex)
268         {
269           throw new IllegalStateException(ex.toString());
270         }
271       }
272
273       public java.lang.Object newInstance(java.lang.Object parent)
274       {
275         return null;
276       }
277     };
278     desc.setHandler(handler);
279     desc.setNameSpaceURI("www.vamsas.ac.uk/jalview/version2");
280     desc.setMultivalued(false);
281     addFieldDescriptor(desc);
282
283     // -- validation code for: _description
284     fieldValidator = new org.exolab.castor.xml.FieldValidator();
285     { // -- local scope
286       org.exolab.castor.xml.validators.StringValidator typeValidator;
287       typeValidator = new org.exolab.castor.xml.validators.StringValidator();
288       fieldValidator.setValidator(typeValidator);
289       typeValidator.setWhiteSpace("preserve");
290     }
291     desc.setValidator(fieldValidator);
292     // -- _secondaryStructure
293     desc = new org.exolab.castor.xml.util.XMLFieldDescriptorImpl(
294             java.lang.String.class, "_secondaryStructure",
295             "secondaryStructure", org.exolab.castor.xml.NodeType.Element);
296     desc.setImmutable(true);
297     handler = new org.exolab.castor.xml.XMLFieldHandler()
298     {
299       public java.lang.Object getValue(java.lang.Object object)
300               throws IllegalStateException
301       {
302         AnnotationElement target = (AnnotationElement) object;
303         return target.getSecondaryStructure();
304       }
305
306       public void setValue(java.lang.Object object, java.lang.Object value)
307               throws IllegalStateException, IllegalArgumentException
308       {
309         try
310         {
311           AnnotationElement target = (AnnotationElement) object;
312           target.setSecondaryStructure((java.lang.String) value);
313         } catch (java.lang.Exception ex)
314         {
315           throw new IllegalStateException(ex.toString());
316         }
317       }
318
319       public java.lang.Object newInstance(java.lang.Object parent)
320       {
321         return null;
322       }
323     };
324     desc.setHandler(handler);
325     desc.setNameSpaceURI("www.vamsas.ac.uk/jalview/version2");
326     desc.setMultivalued(false);
327     addFieldDescriptor(desc);
328
329     // -- validation code for: _secondaryStructure
330     fieldValidator = new org.exolab.castor.xml.FieldValidator();
331     { // -- local scope
332       org.exolab.castor.xml.validators.StringValidator typeValidator;
333       typeValidator = new org.exolab.castor.xml.validators.StringValidator();
334       fieldValidator.setValidator(typeValidator);
335       typeValidator.setWhiteSpace("preserve");
336       typeValidator.setLength(1);
337     }
338     desc.setValidator(fieldValidator);
339     // -- _value
340     desc = new org.exolab.castor.xml.util.XMLFieldDescriptorImpl(
341             java.lang.Float.TYPE, "_value", "value",
342             org.exolab.castor.xml.NodeType.Element);
343     handler = new org.exolab.castor.xml.XMLFieldHandler()
344     {
345       public java.lang.Object getValue(java.lang.Object object)
346               throws IllegalStateException
347       {
348         AnnotationElement target = (AnnotationElement) object;
349         if (!target.hasValue())
350         {
351           return null;
352         }
353         return new java.lang.Float(target.getValue());
354       }
355
356       public void setValue(java.lang.Object object, java.lang.Object value)
357               throws IllegalStateException, IllegalArgumentException
358       {
359         try
360         {
361           AnnotationElement target = (AnnotationElement) object;
362           // if null, use delete method for optional primitives
363           if (value == null)
364           {
365             target.deleteValue();
366             return;
367           }
368           target.setValue(((java.lang.Float) value).floatValue());
369         } catch (java.lang.Exception ex)
370         {
371           throw new IllegalStateException(ex.toString());
372         }
373       }
374
375       public java.lang.Object newInstance(java.lang.Object parent)
376       {
377         return null;
378       }
379     };
380     desc.setHandler(handler);
381     desc.setNameSpaceURI("www.vamsas.ac.uk/jalview/version2");
382     desc.setMultivalued(false);
383     addFieldDescriptor(desc);
384
385     // -- validation code for: _value
386     fieldValidator = new org.exolab.castor.xml.FieldValidator();
387     { // -- local scope
388       org.exolab.castor.xml.validators.FloatValidator typeValidator;
389       typeValidator = new org.exolab.castor.xml.validators.FloatValidator();
390       fieldValidator.setValidator(typeValidator);
391       typeValidator.setMinInclusive((float) -3.4028235E38);
392       typeValidator.setMaxInclusive((float) 3.4028235E38);
393     }
394     desc.setValidator(fieldValidator);
395   }
396
397   // -----------/
398   // - Methods -/
399   // -----------/
400
401   /**
402    * Method getAccessMode.
403    * 
404    * @return the access mode specified for this class.
405    */
406   public org.exolab.castor.mapping.AccessMode getAccessMode()
407   {
408     return null;
409   }
410
411   /**
412    * Method getIdentity.
413    * 
414    * @return the identity field, null if this class has no identity.
415    */
416   public org.exolab.castor.mapping.FieldDescriptor getIdentity()
417   {
418     return super.getIdentity();
419   }
420
421   /**
422    * Method getJavaClass.
423    * 
424    * @return the Java class represented by this descriptor.
425    */
426   public java.lang.Class getJavaClass()
427   {
428     return jalview.schemabinding.version2.AnnotationElement.class;
429   }
430
431   /**
432    * Method getNameSpacePrefix.
433    * 
434    * @return the namespace prefix to use when marshaling as XML.
435    */
436   public java.lang.String getNameSpacePrefix()
437   {
438     return _nsPrefix;
439   }
440
441   /**
442    * Method getNameSpaceURI.
443    * 
444    * @return the namespace URI used when marshaling and unmarshaling as XML.
445    */
446   public java.lang.String getNameSpaceURI()
447   {
448     return _nsURI;
449   }
450
451   /**
452    * Method getValidator.
453    * 
454    * @return a specific validator for the class described by this
455    *         ClassDescriptor.
456    */
457   public org.exolab.castor.xml.TypeValidator getValidator()
458   {
459     return this;
460   }
461
462   /**
463    * Method getXMLName.
464    * 
465    * @return the XML Name for the Class being described.
466    */
467   public java.lang.String getXMLName()
468   {
469     return _xmlName;
470   }
471
472   /**
473    * Method isElementDefinition.
474    * 
475    * @return true if XML schema definition of this Class is that of a global
476    *         element or element with anonymous type definition.
477    */
478   public boolean isElementDefinition()
479   {
480     return _elementDefinition;
481   }
482
483 }