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
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/>.
18 package jalview.schemabinding.version2.descriptors;
20 //---------------------------------/
21 //- Imported classes and packages -/
22 //---------------------------------/
24 import jalview.schemabinding.version2.AnnotationColours;
27 * Class AnnotationColoursDescriptor.
29 * @version $Revision$ $Date$
31 public class AnnotationColoursDescriptor extends
32 org.exolab.castor.xml.util.XMLClassDescriptorImpl
35 // --------------------------/
36 // - Class/Member Variables -/
37 // --------------------------/
40 * Field _elementDefinition.
42 private boolean _elementDefinition;
47 private java.lang.String _nsPrefix;
52 private java.lang.String _nsURI;
57 private java.lang.String _xmlName;
63 public AnnotationColoursDescriptor()
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
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()
80 public java.lang.Object getValue(java.lang.Object object)
81 throws IllegalStateException
83 AnnotationColours target = (AnnotationColours) object;
84 if (!target.hasAboveThreshold())
88 return new java.lang.Integer(target.getAboveThreshold());
91 public void setValue(java.lang.Object object, java.lang.Object value)
92 throws IllegalStateException, IllegalArgumentException
96 AnnotationColours target = (AnnotationColours) object;
97 // if null, use delete method for optional primitives
100 target.deleteAboveThreshold();
103 target.setAboveThreshold(((java.lang.Integer) value).intValue());
104 } catch (java.lang.Exception ex)
106 throw new IllegalStateException(ex.toString());
110 public java.lang.Object newInstance(java.lang.Object parent)
115 desc.setHandler(handler);
116 desc.setMultivalued(false);
117 addFieldDescriptor(desc);
119 // -- validation code for: _aboveThreshold
120 fieldValidator = new org.exolab.castor.xml.FieldValidator();
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);
128 desc.setValidator(fieldValidator);
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()
136 public java.lang.Object getValue(java.lang.Object object)
137 throws IllegalStateException
139 AnnotationColours target = (AnnotationColours) object;
140 return target.getAnnotation();
143 public void setValue(java.lang.Object object, java.lang.Object value)
144 throws IllegalStateException, IllegalArgumentException
148 AnnotationColours target = (AnnotationColours) object;
149 target.setAnnotation((java.lang.String) value);
150 } catch (java.lang.Exception ex)
152 throw new IllegalStateException(ex.toString());
156 public java.lang.Object newInstance(java.lang.Object parent)
161 desc.setHandler(handler);
162 desc.setMultivalued(false);
163 addFieldDescriptor(desc);
165 // -- validation code for: _annotation
166 fieldValidator = new org.exolab.castor.xml.FieldValidator();
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");
173 desc.setValidator(fieldValidator);
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()
180 public java.lang.Object getValue(java.lang.Object object)
181 throws IllegalStateException
183 AnnotationColours target = (AnnotationColours) object;
184 if (!target.hasMinColour())
188 return new java.lang.Integer(target.getMinColour());
191 public void setValue(java.lang.Object object, java.lang.Object value)
192 throws IllegalStateException, IllegalArgumentException
196 AnnotationColours target = (AnnotationColours) object;
197 // if null, use delete method for optional primitives
200 target.deleteMinColour();
203 target.setMinColour(((java.lang.Integer) value).intValue());
204 } catch (java.lang.Exception ex)
206 throw new IllegalStateException(ex.toString());
210 public java.lang.Object newInstance(java.lang.Object parent)
215 desc.setHandler(handler);
216 desc.setMultivalued(false);
217 addFieldDescriptor(desc);
219 // -- validation code for: _minColour
220 fieldValidator = new org.exolab.castor.xml.FieldValidator();
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);
228 desc.setValidator(fieldValidator);
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()
235 public java.lang.Object getValue(java.lang.Object object)
236 throws IllegalStateException
238 AnnotationColours target = (AnnotationColours) object;
239 if (!target.hasMaxColour())
243 return new java.lang.Integer(target.getMaxColour());
246 public void setValue(java.lang.Object object, java.lang.Object value)
247 throws IllegalStateException, IllegalArgumentException
251 AnnotationColours target = (AnnotationColours) object;
252 // if null, use delete method for optional primitives
255 target.deleteMaxColour();
258 target.setMaxColour(((java.lang.Integer) value).intValue());
259 } catch (java.lang.Exception ex)
261 throw new IllegalStateException(ex.toString());
265 public java.lang.Object newInstance(java.lang.Object parent)
270 desc.setHandler(handler);
271 desc.setMultivalued(false);
272 addFieldDescriptor(desc);
274 // -- validation code for: _maxColour
275 fieldValidator = new org.exolab.castor.xml.FieldValidator();
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);
283 desc.setValidator(fieldValidator);
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()
291 public java.lang.Object getValue(java.lang.Object object)
292 throws IllegalStateException
294 AnnotationColours target = (AnnotationColours) object;
295 return target.getColourScheme();
298 public void setValue(java.lang.Object object, java.lang.Object value)
299 throws IllegalStateException, IllegalArgumentException
303 AnnotationColours target = (AnnotationColours) object;
304 target.setColourScheme((java.lang.String) value);
305 } catch (java.lang.Exception ex)
307 throw new IllegalStateException(ex.toString());
311 public java.lang.Object newInstance(java.lang.Object parent)
316 desc.setHandler(handler);
317 desc.setMultivalued(false);
318 addFieldDescriptor(desc);
320 // -- validation code for: _colourScheme
321 fieldValidator = new org.exolab.castor.xml.FieldValidator();
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");
328 desc.setValidator(fieldValidator);
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()
335 public java.lang.Object getValue(java.lang.Object object)
336 throws IllegalStateException
338 AnnotationColours target = (AnnotationColours) object;
339 if (!target.hasThreshold())
343 return new java.lang.Float(target.getThreshold());
346 public void setValue(java.lang.Object object, java.lang.Object value)
347 throws IllegalStateException, IllegalArgumentException
351 AnnotationColours target = (AnnotationColours) object;
352 // if null, use delete method for optional primitives
355 target.deleteThreshold();
358 target.setThreshold(((java.lang.Float) value).floatValue());
359 } catch (java.lang.Exception ex)
361 throw new IllegalStateException(ex.toString());
365 public java.lang.Object newInstance(java.lang.Object parent)
370 desc.setHandler(handler);
371 desc.setMultivalued(false);
372 addFieldDescriptor(desc);
374 // -- validation code for: _threshold
375 fieldValidator = new org.exolab.castor.xml.FieldValidator();
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);
383 desc.setValidator(fieldValidator);
384 // -- initialize element descriptors
393 * Method getAccessMode.
395 * @return the access mode specified for this class.
397 public org.exolab.castor.mapping.AccessMode getAccessMode()
403 * Method getIdentity.
405 * @return the identity field, null if this class has no identity.
407 public org.exolab.castor.mapping.FieldDescriptor getIdentity()
409 return super.getIdentity();
413 * Method getJavaClass.
415 * @return the Java class represented by this descriptor.
417 public java.lang.Class getJavaClass()
419 return jalview.schemabinding.version2.AnnotationColours.class;
423 * Method getNameSpacePrefix.
425 * @return the namespace prefix to use when marshaling as XML.
427 public java.lang.String getNameSpacePrefix()
433 * Method getNameSpaceURI.
435 * @return the namespace URI used when marshaling and unmarshaling as XML.
437 public java.lang.String getNameSpaceURI()
443 * Method getValidator.
445 * @return a specific validator for the class described by this
448 public org.exolab.castor.xml.TypeValidator getValidator()
456 * @return the XML Name for the Class being described.
458 public java.lang.String getXMLName()
464 * Method isElementDefinition.
466 * @return true if XML schema definition of this Class is that of a global
467 * element or element with anonymous type definition.
469 public boolean isElementDefinition()
471 return _elementDefinition;