JAL-1432 updated copyright notices
[jalview.git] / src / jalview / schemabinding / version2 / descriptors / ThresholdLineDescriptor.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.ThresholdLine;
26
27 /**
28  * Class ThresholdLineDescriptor.
29  * 
30  * @version $Revision$ $Date$
31  */
32 public class ThresholdLineDescriptor 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 ThresholdLineDescriptor()
65   {
66     super();
67     _nsURI = "www.vamsas.ac.uk/jalview/version2";
68     _xmlName = "thresholdLine";
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     // -- _label
76     desc = new org.exolab.castor.xml.util.XMLFieldDescriptorImpl(
77             java.lang.String.class, "_label", "label",
78             org.exolab.castor.xml.NodeType.Attribute);
79     desc.setImmutable(true);
80     handler = new org.exolab.castor.xml.XMLFieldHandler()
81     {
82       public java.lang.Object getValue(java.lang.Object object)
83               throws IllegalStateException
84       {
85         ThresholdLine target = (ThresholdLine) object;
86         return target.getLabel();
87       }
88
89       public void setValue(java.lang.Object object, java.lang.Object value)
90               throws IllegalStateException, IllegalArgumentException
91       {
92         try
93         {
94           ThresholdLine target = (ThresholdLine) object;
95           target.setLabel((java.lang.String) value);
96         } catch (java.lang.Exception ex)
97         {
98           throw new IllegalStateException(ex.toString());
99         }
100       }
101
102       public java.lang.Object newInstance(java.lang.Object parent)
103       {
104         return null;
105       }
106     };
107     desc.setHandler(handler);
108     desc.setMultivalued(false);
109     addFieldDescriptor(desc);
110
111     // -- validation code for: _label
112     fieldValidator = new org.exolab.castor.xml.FieldValidator();
113     { // -- local scope
114       org.exolab.castor.xml.validators.StringValidator typeValidator;
115       typeValidator = new org.exolab.castor.xml.validators.StringValidator();
116       fieldValidator.setValidator(typeValidator);
117       typeValidator.setWhiteSpace("preserve");
118     }
119     desc.setValidator(fieldValidator);
120     // -- _value
121     desc = new org.exolab.castor.xml.util.XMLFieldDescriptorImpl(
122             java.lang.Float.TYPE, "_value", "value",
123             org.exolab.castor.xml.NodeType.Attribute);
124     handler = new org.exolab.castor.xml.XMLFieldHandler()
125     {
126       public java.lang.Object getValue(java.lang.Object object)
127               throws IllegalStateException
128       {
129         ThresholdLine target = (ThresholdLine) object;
130         if (!target.hasValue())
131         {
132           return null;
133         }
134         return new java.lang.Float(target.getValue());
135       }
136
137       public void setValue(java.lang.Object object, java.lang.Object value)
138               throws IllegalStateException, IllegalArgumentException
139       {
140         try
141         {
142           ThresholdLine target = (ThresholdLine) object;
143           // if null, use delete method for optional primitives
144           if (value == null)
145           {
146             target.deleteValue();
147             return;
148           }
149           target.setValue(((java.lang.Float) value).floatValue());
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: _value
166     fieldValidator = new org.exolab.castor.xml.FieldValidator();
167     { // -- local scope
168       org.exolab.castor.xml.validators.FloatValidator typeValidator;
169       typeValidator = new org.exolab.castor.xml.validators.FloatValidator();
170       fieldValidator.setValidator(typeValidator);
171       typeValidator.setMinInclusive((float) -3.4028235E38);
172       typeValidator.setMaxInclusive((float) 3.4028235E38);
173     }
174     desc.setValidator(fieldValidator);
175     // -- _colour
176     desc = new org.exolab.castor.xml.util.XMLFieldDescriptorImpl(
177             java.lang.Integer.TYPE, "_colour", "colour",
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         ThresholdLine target = (ThresholdLine) object;
185         if (!target.hasColour())
186         {
187           return null;
188         }
189         return new java.lang.Integer(target.getColour());
190       }
191
192       public void setValue(java.lang.Object object, java.lang.Object value)
193               throws IllegalStateException, IllegalArgumentException
194       {
195         try
196         {
197           ThresholdLine target = (ThresholdLine) object;
198           // if null, use delete method for optional primitives
199           if (value == null)
200           {
201             target.deleteColour();
202             return;
203           }
204           target.setColour(((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: _colour
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     // -- initialize element descriptors
231
232   }
233
234   // -----------/
235   // - Methods -/
236   // -----------/
237
238   /**
239    * Method getAccessMode.
240    * 
241    * @return the access mode specified for this class.
242    */
243   public org.exolab.castor.mapping.AccessMode getAccessMode()
244   {
245     return null;
246   }
247
248   /**
249    * Method getIdentity.
250    * 
251    * @return the identity field, null if this class has no identity.
252    */
253   public org.exolab.castor.mapping.FieldDescriptor getIdentity()
254   {
255     return super.getIdentity();
256   }
257
258   /**
259    * Method getJavaClass.
260    * 
261    * @return the Java class represented by this descriptor.
262    */
263   public java.lang.Class getJavaClass()
264   {
265     return jalview.schemabinding.version2.ThresholdLine.class;
266   }
267
268   /**
269    * Method getNameSpacePrefix.
270    * 
271    * @return the namespace prefix to use when marshaling as XML.
272    */
273   public java.lang.String getNameSpacePrefix()
274   {
275     return _nsPrefix;
276   }
277
278   /**
279    * Method getNameSpaceURI.
280    * 
281    * @return the namespace URI used when marshaling and unmarshaling as XML.
282    */
283   public java.lang.String getNameSpaceURI()
284   {
285     return _nsURI;
286   }
287
288   /**
289    * Method getValidator.
290    * 
291    * @return a specific validator for the class described by this
292    *         ClassDescriptor.
293    */
294   public org.exolab.castor.xml.TypeValidator getValidator()
295   {
296     return this;
297   }
298
299   /**
300    * Method getXMLName.
301    * 
302    * @return the XML Name for the Class being described.
303    */
304   public java.lang.String getXMLName()
305   {
306     return _xmlName;
307   }
308
309   /**
310    * Method isElementDefinition.
311    * 
312    * @return true if XML schema definition of this Class is that of a global
313    *         element or element with anonymous type definition.
314    */
315   public boolean isElementDefinition()
316   {
317     return _elementDefinition;
318   }
319
320 }