2 * Jalview - A Sequence Alignment Editor and Viewer (Version 2.8.0b1)
3 * Copyright (C) 2014 The Jalview Authors
5 * This file is part of Jalview.
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.
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.
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.
19 package jalview.schemabinding.version2.descriptors;
21 //---------------------------------/
22 //- Imported classes and packages -/
23 //---------------------------------/
25 import jalview.schemabinding.version2.AnnotationColours;
28 * Class AnnotationColoursDescriptor.
30 * @version $Revision$ $Date$
32 public class AnnotationColoursDescriptor extends
33 org.exolab.castor.xml.util.XMLClassDescriptorImpl
36 // --------------------------/
37 // - Class/Member Variables -/
38 // --------------------------/
41 * Field _elementDefinition.
43 private boolean _elementDefinition;
48 private java.lang.String _nsPrefix;
53 private java.lang.String _nsURI;
58 private java.lang.String _xmlName;
64 public AnnotationColoursDescriptor()
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
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()
81 public java.lang.Object getValue(java.lang.Object object)
82 throws IllegalStateException
84 AnnotationColours target = (AnnotationColours) object;
85 if (!target.hasAboveThreshold())
89 return new java.lang.Integer(target.getAboveThreshold());
92 public void setValue(java.lang.Object object, java.lang.Object value)
93 throws IllegalStateException, IllegalArgumentException
97 AnnotationColours target = (AnnotationColours) object;
98 // if null, use delete method for optional primitives
101 target.deleteAboveThreshold();
104 target.setAboveThreshold(((java.lang.Integer) value).intValue());
105 } catch (java.lang.Exception ex)
107 throw new IllegalStateException(ex.toString());
111 public java.lang.Object newInstance(java.lang.Object parent)
116 desc.setHandler(handler);
117 desc.setMultivalued(false);
118 addFieldDescriptor(desc);
120 // -- validation code for: _aboveThreshold
121 fieldValidator = new org.exolab.castor.xml.FieldValidator();
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);
129 desc.setValidator(fieldValidator);
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()
137 public java.lang.Object getValue(java.lang.Object object)
138 throws IllegalStateException
140 AnnotationColours target = (AnnotationColours) object;
141 return target.getAnnotation();
144 public void setValue(java.lang.Object object, java.lang.Object value)
145 throws IllegalStateException, IllegalArgumentException
149 AnnotationColours target = (AnnotationColours) object;
150 target.setAnnotation((java.lang.String) value);
151 } catch (java.lang.Exception ex)
153 throw new IllegalStateException(ex.toString());
157 public java.lang.Object newInstance(java.lang.Object parent)
162 desc.setHandler(handler);
163 desc.setMultivalued(false);
164 addFieldDescriptor(desc);
166 // -- validation code for: _annotation
167 fieldValidator = new org.exolab.castor.xml.FieldValidator();
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");
174 desc.setValidator(fieldValidator);
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()
181 public java.lang.Object getValue(java.lang.Object object)
182 throws IllegalStateException
184 AnnotationColours target = (AnnotationColours) object;
185 if (!target.hasMinColour())
189 return new java.lang.Integer(target.getMinColour());
192 public void setValue(java.lang.Object object, java.lang.Object value)
193 throws IllegalStateException, IllegalArgumentException
197 AnnotationColours target = (AnnotationColours) object;
198 // if null, use delete method for optional primitives
201 target.deleteMinColour();
204 target.setMinColour(((java.lang.Integer) value).intValue());
205 } catch (java.lang.Exception ex)
207 throw new IllegalStateException(ex.toString());
211 public java.lang.Object newInstance(java.lang.Object parent)
216 desc.setHandler(handler);
217 desc.setMultivalued(false);
218 addFieldDescriptor(desc);
220 // -- validation code for: _minColour
221 fieldValidator = new org.exolab.castor.xml.FieldValidator();
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);
229 desc.setValidator(fieldValidator);
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()
236 public java.lang.Object getValue(java.lang.Object object)
237 throws IllegalStateException
239 AnnotationColours target = (AnnotationColours) object;
240 if (!target.hasMaxColour())
244 return new java.lang.Integer(target.getMaxColour());
247 public void setValue(java.lang.Object object, java.lang.Object value)
248 throws IllegalStateException, IllegalArgumentException
252 AnnotationColours target = (AnnotationColours) object;
253 // if null, use delete method for optional primitives
256 target.deleteMaxColour();
259 target.setMaxColour(((java.lang.Integer) value).intValue());
260 } catch (java.lang.Exception ex)
262 throw new IllegalStateException(ex.toString());
266 public java.lang.Object newInstance(java.lang.Object parent)
271 desc.setHandler(handler);
272 desc.setMultivalued(false);
273 addFieldDescriptor(desc);
275 // -- validation code for: _maxColour
276 fieldValidator = new org.exolab.castor.xml.FieldValidator();
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);
284 desc.setValidator(fieldValidator);
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()
292 public java.lang.Object getValue(java.lang.Object object)
293 throws IllegalStateException
295 AnnotationColours target = (AnnotationColours) object;
296 return target.getColourScheme();
299 public void setValue(java.lang.Object object, java.lang.Object value)
300 throws IllegalStateException, IllegalArgumentException
304 AnnotationColours target = (AnnotationColours) object;
305 target.setColourScheme((java.lang.String) value);
306 } catch (java.lang.Exception ex)
308 throw new IllegalStateException(ex.toString());
312 public java.lang.Object newInstance(java.lang.Object parent)
317 desc.setHandler(handler);
318 desc.setMultivalued(false);
319 addFieldDescriptor(desc);
321 // -- validation code for: _colourScheme
322 fieldValidator = new org.exolab.castor.xml.FieldValidator();
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");
329 desc.setValidator(fieldValidator);
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()
336 public java.lang.Object getValue(java.lang.Object object)
337 throws IllegalStateException
339 AnnotationColours target = (AnnotationColours) object;
340 if (!target.hasThreshold())
344 return new java.lang.Float(target.getThreshold());
347 public void setValue(java.lang.Object object, java.lang.Object value)
348 throws IllegalStateException, IllegalArgumentException
352 AnnotationColours target = (AnnotationColours) object;
353 // if null, use delete method for optional primitives
356 target.deleteThreshold();
359 target.setThreshold(((java.lang.Float) value).floatValue());
360 } catch (java.lang.Exception ex)
362 throw new IllegalStateException(ex.toString());
366 public java.lang.Object newInstance(java.lang.Object parent)
371 desc.setHandler(handler);
372 desc.setMultivalued(false);
373 addFieldDescriptor(desc);
375 // -- validation code for: _threshold
376 fieldValidator = new org.exolab.castor.xml.FieldValidator();
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);
384 desc.setValidator(fieldValidator);
385 // -- initialize element descriptors
394 * Method getAccessMode.
396 * @return the access mode specified for this class.
398 public org.exolab.castor.mapping.AccessMode getAccessMode()
404 * Method getIdentity.
406 * @return the identity field, null if this class has no identity.
408 public org.exolab.castor.mapping.FieldDescriptor getIdentity()
410 return super.getIdentity();
414 * Method getJavaClass.
416 * @return the Java class represented by this descriptor.
418 public java.lang.Class getJavaClass()
420 return jalview.schemabinding.version2.AnnotationColours.class;
424 * Method getNameSpacePrefix.
426 * @return the namespace prefix to use when marshaling as XML.
428 public java.lang.String getNameSpacePrefix()
434 * Method getNameSpaceURI.
436 * @return the namespace URI used when marshaling and unmarshaling as XML.
438 public java.lang.String getNameSpaceURI()
444 * Method getValidator.
446 * @return a specific validator for the class described by this
449 public org.exolab.castor.xml.TypeValidator getValidator()
457 * @return the XML Name for the Class being described.
459 public java.lang.String getXMLName()
465 * Method isElementDefinition.
467 * @return true if XML schema definition of this Class is that of a global
468 * element or element with anonymous type definition.
470 public boolean isElementDefinition()
472 return _elementDefinition;