2 * Jalview - A Sequence Alignment Editor and Viewer (Version 2.8.2)
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
10 * of the License, or (at your option) any later version.
12 * Jalview is distributed in the hope that it will be useful, but
13 * WITHOUT ANY WARRANTY; without even the implied warranty
14 * of MERCHANTABILITY or FITNESS FOR A PARTICULAR
15 * PURPOSE. See the GNU General Public License for more details.
17 * You should have received a copy of the GNU General Public License
18 * along with Jalview. If not, see <http://www.gnu.org/licenses/>.
19 * The Jalview Authors are detailed in the 'AUTHORS' file.
21 package jalview.schemabinding.version2.descriptors;
23 //---------------------------------/
24 //- Imported classes and packages -/
25 //---------------------------------/
27 import jalview.schemabinding.version2.AnnotationColourScheme;
30 * Class AnnotationColourSchemeDescriptor.
32 * @version $Revision$ $Date$
34 public class AnnotationColourSchemeDescriptor extends
35 org.exolab.castor.xml.util.XMLClassDescriptorImpl
38 // --------------------------/
39 // - Class/Member Variables -/
40 // --------------------------/
43 * Field _elementDefinition.
45 private boolean _elementDefinition;
50 private java.lang.String _nsPrefix;
55 private java.lang.String _nsURI;
60 private java.lang.String _xmlName;
66 public AnnotationColourSchemeDescriptor()
69 _nsURI = "www.jalview.org";
70 _xmlName = "AnnotationColourScheme";
71 _elementDefinition = false;
72 org.exolab.castor.xml.util.XMLFieldDescriptorImpl desc = null;
73 org.exolab.castor.mapping.FieldHandler handler = null;
74 org.exolab.castor.xml.FieldValidator fieldValidator = null;
75 // -- initialize attribute descriptors
78 desc = new org.exolab.castor.xml.util.XMLFieldDescriptorImpl(
79 java.lang.Integer.TYPE, "_aboveThreshold", "aboveThreshold",
80 org.exolab.castor.xml.NodeType.Attribute);
81 handler = new org.exolab.castor.xml.XMLFieldHandler()
83 public java.lang.Object getValue(java.lang.Object object)
84 throws IllegalStateException
86 AnnotationColourScheme target = (AnnotationColourScheme) object;
87 if (!target.hasAboveThreshold())
91 return new java.lang.Integer(target.getAboveThreshold());
94 public void setValue(java.lang.Object object, java.lang.Object value)
95 throws IllegalStateException, IllegalArgumentException
99 AnnotationColourScheme target = (AnnotationColourScheme) object;
100 // if null, use delete method for optional primitives
103 target.deleteAboveThreshold();
106 target.setAboveThreshold(((java.lang.Integer) value).intValue());
107 } catch (java.lang.Exception ex)
109 throw new IllegalStateException(ex.toString());
113 public java.lang.Object newInstance(java.lang.Object parent)
118 desc.setHandler(handler);
119 desc.setMultivalued(false);
120 addFieldDescriptor(desc);
122 // -- validation code for: _aboveThreshold
123 fieldValidator = new org.exolab.castor.xml.FieldValidator();
125 org.exolab.castor.xml.validators.IntValidator typeValidator;
126 typeValidator = new org.exolab.castor.xml.validators.IntValidator();
127 fieldValidator.setValidator(typeValidator);
128 typeValidator.setMinInclusive(-2147483648);
129 typeValidator.setMaxInclusive(2147483647);
131 desc.setValidator(fieldValidator);
133 desc = new org.exolab.castor.xml.util.XMLFieldDescriptorImpl(
134 java.lang.String.class, "_annotation", "annotation",
135 org.exolab.castor.xml.NodeType.Attribute);
136 desc.setImmutable(true);
137 handler = new org.exolab.castor.xml.XMLFieldHandler()
139 public java.lang.Object getValue(java.lang.Object object)
140 throws IllegalStateException
142 AnnotationColourScheme target = (AnnotationColourScheme) object;
143 return target.getAnnotation();
146 public void setValue(java.lang.Object object, java.lang.Object value)
147 throws IllegalStateException, IllegalArgumentException
151 AnnotationColourScheme target = (AnnotationColourScheme) object;
152 target.setAnnotation((java.lang.String) value);
153 } catch (java.lang.Exception ex)
155 throw new IllegalStateException(ex.toString());
159 public java.lang.Object newInstance(java.lang.Object parent)
164 desc.setHandler(handler);
165 desc.setMultivalued(false);
166 addFieldDescriptor(desc);
168 // -- validation code for: _annotation
169 fieldValidator = new org.exolab.castor.xml.FieldValidator();
171 org.exolab.castor.xml.validators.StringValidator typeValidator;
172 typeValidator = new org.exolab.castor.xml.validators.StringValidator();
173 fieldValidator.setValidator(typeValidator);
174 typeValidator.setWhiteSpace("preserve");
176 desc.setValidator(fieldValidator);
178 desc = new org.exolab.castor.xml.util.XMLFieldDescriptorImpl(
179 java.lang.Integer.TYPE, "_minColour", "minColour",
180 org.exolab.castor.xml.NodeType.Attribute);
181 handler = new org.exolab.castor.xml.XMLFieldHandler()
183 public java.lang.Object getValue(java.lang.Object object)
184 throws IllegalStateException
186 AnnotationColourScheme target = (AnnotationColourScheme) object;
187 if (!target.hasMinColour())
191 return new java.lang.Integer(target.getMinColour());
194 public void setValue(java.lang.Object object, java.lang.Object value)
195 throws IllegalStateException, IllegalArgumentException
199 AnnotationColourScheme target = (AnnotationColourScheme) object;
200 // if null, use delete method for optional primitives
203 target.deleteMinColour();
206 target.setMinColour(((java.lang.Integer) value).intValue());
207 } catch (java.lang.Exception ex)
209 throw new IllegalStateException(ex.toString());
213 public java.lang.Object newInstance(java.lang.Object parent)
218 desc.setHandler(handler);
219 desc.setMultivalued(false);
220 addFieldDescriptor(desc);
222 // -- validation code for: _minColour
223 fieldValidator = new org.exolab.castor.xml.FieldValidator();
225 org.exolab.castor.xml.validators.IntValidator typeValidator;
226 typeValidator = new org.exolab.castor.xml.validators.IntValidator();
227 fieldValidator.setValidator(typeValidator);
228 typeValidator.setMinInclusive(-2147483648);
229 typeValidator.setMaxInclusive(2147483647);
231 desc.setValidator(fieldValidator);
233 desc = new org.exolab.castor.xml.util.XMLFieldDescriptorImpl(
234 java.lang.Integer.TYPE, "_maxColour", "maxColour",
235 org.exolab.castor.xml.NodeType.Attribute);
236 handler = new org.exolab.castor.xml.XMLFieldHandler()
238 public java.lang.Object getValue(java.lang.Object object)
239 throws IllegalStateException
241 AnnotationColourScheme target = (AnnotationColourScheme) object;
242 if (!target.hasMaxColour())
246 return new java.lang.Integer(target.getMaxColour());
249 public void setValue(java.lang.Object object, java.lang.Object value)
250 throws IllegalStateException, IllegalArgumentException
254 AnnotationColourScheme target = (AnnotationColourScheme) object;
255 // if null, use delete method for optional primitives
258 target.deleteMaxColour();
261 target.setMaxColour(((java.lang.Integer) value).intValue());
262 } catch (java.lang.Exception ex)
264 throw new IllegalStateException(ex.toString());
268 public java.lang.Object newInstance(java.lang.Object parent)
273 desc.setHandler(handler);
274 desc.setMultivalued(false);
275 addFieldDescriptor(desc);
277 // -- validation code for: _maxColour
278 fieldValidator = new org.exolab.castor.xml.FieldValidator();
280 org.exolab.castor.xml.validators.IntValidator typeValidator;
281 typeValidator = new org.exolab.castor.xml.validators.IntValidator();
282 fieldValidator.setValidator(typeValidator);
283 typeValidator.setMinInclusive(-2147483648);
284 typeValidator.setMaxInclusive(2147483647);
286 desc.setValidator(fieldValidator);
288 desc = new org.exolab.castor.xml.util.XMLFieldDescriptorImpl(
289 java.lang.String.class, "_colourScheme", "colourScheme",
290 org.exolab.castor.xml.NodeType.Attribute);
291 desc.setImmutable(true);
292 handler = new org.exolab.castor.xml.XMLFieldHandler()
294 public java.lang.Object getValue(java.lang.Object object)
295 throws IllegalStateException
297 AnnotationColourScheme target = (AnnotationColourScheme) object;
298 return target.getColourScheme();
301 public void setValue(java.lang.Object object, java.lang.Object value)
302 throws IllegalStateException, IllegalArgumentException
306 AnnotationColourScheme target = (AnnotationColourScheme) object;
307 target.setColourScheme((java.lang.String) value);
308 } catch (java.lang.Exception ex)
310 throw new IllegalStateException(ex.toString());
314 public java.lang.Object newInstance(java.lang.Object parent)
319 desc.setHandler(handler);
320 desc.setMultivalued(false);
321 addFieldDescriptor(desc);
323 // -- validation code for: _colourScheme
324 fieldValidator = new org.exolab.castor.xml.FieldValidator();
326 org.exolab.castor.xml.validators.StringValidator typeValidator;
327 typeValidator = new org.exolab.castor.xml.validators.StringValidator();
328 fieldValidator.setValidator(typeValidator);
329 typeValidator.setWhiteSpace("preserve");
331 desc.setValidator(fieldValidator);
333 desc = new org.exolab.castor.xml.util.XMLFieldDescriptorImpl(
334 java.lang.Float.TYPE, "_threshold", "threshold",
335 org.exolab.castor.xml.NodeType.Attribute);
336 handler = new org.exolab.castor.xml.XMLFieldHandler()
338 public java.lang.Object getValue(java.lang.Object object)
339 throws IllegalStateException
341 AnnotationColourScheme target = (AnnotationColourScheme) object;
342 if (!target.hasThreshold())
346 return new java.lang.Float(target.getThreshold());
349 public void setValue(java.lang.Object object, java.lang.Object value)
350 throws IllegalStateException, IllegalArgumentException
354 AnnotationColourScheme target = (AnnotationColourScheme) object;
355 // if null, use delete method for optional primitives
358 target.deleteThreshold();
361 target.setThreshold(((java.lang.Float) value).floatValue());
362 } catch (java.lang.Exception ex)
364 throw new IllegalStateException(ex.toString());
368 public java.lang.Object newInstance(java.lang.Object parent)
373 desc.setHandler(handler);
374 desc.setMultivalued(false);
375 addFieldDescriptor(desc);
377 // -- validation code for: _threshold
378 fieldValidator = new org.exolab.castor.xml.FieldValidator();
380 org.exolab.castor.xml.validators.FloatValidator typeValidator;
381 typeValidator = new org.exolab.castor.xml.validators.FloatValidator();
382 fieldValidator.setValidator(typeValidator);
383 typeValidator.setMinInclusive((float) -3.4028235E38);
384 typeValidator.setMaxInclusive((float) 3.4028235E38);
386 desc.setValidator(fieldValidator);
388 desc = new org.exolab.castor.xml.util.XMLFieldDescriptorImpl(
389 java.lang.Boolean.TYPE, "_perSequence", "perSequence",
390 org.exolab.castor.xml.NodeType.Attribute);
391 handler = new org.exolab.castor.xml.XMLFieldHandler()
393 public java.lang.Object getValue(java.lang.Object object)
394 throws IllegalStateException
396 AnnotationColourScheme target = (AnnotationColourScheme) object;
397 if (!target.hasPerSequence())
401 return (target.getPerSequence() ? java.lang.Boolean.TRUE
402 : java.lang.Boolean.FALSE);
405 public void setValue(java.lang.Object object, java.lang.Object value)
406 throws IllegalStateException, IllegalArgumentException
410 AnnotationColourScheme target = (AnnotationColourScheme) object;
411 // if null, use delete method for optional primitives
414 target.deletePerSequence();
417 target.setPerSequence(((java.lang.Boolean) value).booleanValue());
418 } catch (java.lang.Exception ex)
420 throw new IllegalStateException(ex.toString());
424 public java.lang.Object newInstance(java.lang.Object parent)
429 desc.setHandler(handler);
430 desc.setMultivalued(false);
431 addFieldDescriptor(desc);
433 // -- validation code for: _perSequence
434 fieldValidator = new org.exolab.castor.xml.FieldValidator();
436 org.exolab.castor.xml.validators.BooleanValidator typeValidator;
437 typeValidator = new org.exolab.castor.xml.validators.BooleanValidator();
438 fieldValidator.setValidator(typeValidator);
440 desc.setValidator(fieldValidator);
441 // -- _predefinedColours
442 desc = new org.exolab.castor.xml.util.XMLFieldDescriptorImpl(
443 java.lang.Boolean.TYPE, "_predefinedColours",
444 "predefinedColours", org.exolab.castor.xml.NodeType.Attribute);
445 handler = new org.exolab.castor.xml.XMLFieldHandler()
447 public java.lang.Object getValue(java.lang.Object object)
448 throws IllegalStateException
450 AnnotationColourScheme target = (AnnotationColourScheme) object;
451 if (!target.hasPredefinedColours())
455 return (target.getPredefinedColours() ? java.lang.Boolean.TRUE
456 : java.lang.Boolean.FALSE);
459 public void setValue(java.lang.Object object, java.lang.Object value)
460 throws IllegalStateException, IllegalArgumentException
464 AnnotationColourScheme target = (AnnotationColourScheme) object;
465 // if null, use delete method for optional primitives
468 target.deletePredefinedColours();
471 target.setPredefinedColours(((java.lang.Boolean) value)
473 } catch (java.lang.Exception ex)
475 throw new IllegalStateException(ex.toString());
479 public java.lang.Object newInstance(java.lang.Object parent)
484 desc.setHandler(handler);
485 desc.setMultivalued(false);
486 addFieldDescriptor(desc);
488 // -- validation code for: _predefinedColours
489 fieldValidator = new org.exolab.castor.xml.FieldValidator();
491 org.exolab.castor.xml.validators.BooleanValidator typeValidator;
492 typeValidator = new org.exolab.castor.xml.validators.BooleanValidator();
493 fieldValidator.setValidator(typeValidator);
495 desc.setValidator(fieldValidator);
496 // -- initialize element descriptors
505 * Method getAccessMode.
507 * @return the access mode specified for this class.
509 public org.exolab.castor.mapping.AccessMode getAccessMode()
515 * Method getIdentity.
517 * @return the identity field, null if this class has no identity.
519 public org.exolab.castor.mapping.FieldDescriptor getIdentity()
521 return super.getIdentity();
525 * Method getJavaClass.
527 * @return the Java class represented by this descriptor.
529 public java.lang.Class getJavaClass()
531 return jalview.schemabinding.version2.AnnotationColourScheme.class;
535 * Method getNameSpacePrefix.
537 * @return the namespace prefix to use when marshaling as XML.
539 public java.lang.String getNameSpacePrefix()
545 * Method getNameSpaceURI.
547 * @return the namespace URI used when marshaling and unmarshaling as XML.
549 public java.lang.String getNameSpaceURI()
555 * Method getValidator.
557 * @return a specific validator for the class described by this
560 public org.exolab.castor.xml.TypeValidator getValidator()
568 * @return the XML Name for the Class being described.
570 public java.lang.String getXMLName()
576 * Method isElementDefinition.
578 * @return true if XML schema definition of this Class is that of a global
579 * element or element with anonymous type definition.
581 public boolean isElementDefinition()
583 return _elementDefinition;