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