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.
20 package jalview.schemabinding.version2.descriptors;
22 //---------------------------------/
23 //- Imported classes and packages -/
24 //---------------------------------/
26 import jalview.schemabinding.version2.AnnotationColours;
29 * Class AnnotationColoursDescriptor.
31 * @version $Revision$ $Date$
33 public class AnnotationColoursDescriptor extends 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;
65 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(java.lang.Integer.TYPE, "_aboveThreshold", "aboveThreshold", org.exolab.castor.xml.NodeType.Attribute);
77 handler = new org.exolab.castor.xml.XMLFieldHandler() {
78 public java.lang.Object getValue( java.lang.Object object )
79 throws IllegalStateException
81 AnnotationColours target = (AnnotationColours) object;
82 if (!target.hasAboveThreshold()) { return null; }
83 return new java.lang.Integer(target.getAboveThreshold());
85 public void setValue( java.lang.Object object, java.lang.Object value)
86 throws IllegalStateException, IllegalArgumentException
89 AnnotationColours target = (AnnotationColours) object;
90 // if null, use delete method for optional primitives
92 target.deleteAboveThreshold();
95 target.setAboveThreshold( ((java.lang.Integer) value).intValue());
96 } catch (java.lang.Exception ex) {
97 throw new IllegalStateException(ex.toString());
100 public java.lang.Object newInstance(java.lang.Object parent) {
104 desc.setHandler(handler);
105 desc.setMultivalued(false);
106 addFieldDescriptor(desc);
108 //-- validation code for: _aboveThreshold
109 fieldValidator = new org.exolab.castor.xml.FieldValidator();
111 org.exolab.castor.xml.validators.IntValidator typeValidator;
112 typeValidator = new org.exolab.castor.xml.validators.IntValidator();
113 fieldValidator.setValidator(typeValidator);
114 typeValidator.setMinInclusive(-2147483648);
115 typeValidator.setMaxInclusive(2147483647);
117 desc.setValidator(fieldValidator);
119 desc = new org.exolab.castor.xml.util.XMLFieldDescriptorImpl(java.lang.String.class, "_annotation", "annotation", org.exolab.castor.xml.NodeType.Attribute);
120 desc.setImmutable(true);
121 handler = new org.exolab.castor.xml.XMLFieldHandler() {
122 public java.lang.Object getValue( java.lang.Object object )
123 throws IllegalStateException
125 AnnotationColours target = (AnnotationColours) object;
126 return target.getAnnotation();
128 public void setValue( java.lang.Object object, java.lang.Object value)
129 throws IllegalStateException, IllegalArgumentException
132 AnnotationColours target = (AnnotationColours) object;
133 target.setAnnotation( (java.lang.String) value);
134 } catch (java.lang.Exception ex) {
135 throw new IllegalStateException(ex.toString());
138 public java.lang.Object newInstance(java.lang.Object parent) {
142 desc.setHandler(handler);
143 desc.setMultivalued(false);
144 addFieldDescriptor(desc);
146 //-- validation code for: _annotation
147 fieldValidator = new org.exolab.castor.xml.FieldValidator();
149 org.exolab.castor.xml.validators.StringValidator typeValidator;
150 typeValidator = new org.exolab.castor.xml.validators.StringValidator();
151 fieldValidator.setValidator(typeValidator);
152 typeValidator.setWhiteSpace("preserve");
154 desc.setValidator(fieldValidator);
156 desc = new org.exolab.castor.xml.util.XMLFieldDescriptorImpl(java.lang.Integer.TYPE, "_minColour", "minColour", org.exolab.castor.xml.NodeType.Attribute);
157 handler = new org.exolab.castor.xml.XMLFieldHandler() {
158 public java.lang.Object getValue( java.lang.Object object )
159 throws IllegalStateException
161 AnnotationColours target = (AnnotationColours) object;
162 if (!target.hasMinColour()) { return null; }
163 return new java.lang.Integer(target.getMinColour());
165 public void setValue( java.lang.Object object, java.lang.Object value)
166 throws IllegalStateException, IllegalArgumentException
169 AnnotationColours target = (AnnotationColours) object;
170 // if null, use delete method for optional primitives
172 target.deleteMinColour();
175 target.setMinColour( ((java.lang.Integer) value).intValue());
176 } catch (java.lang.Exception ex) {
177 throw new IllegalStateException(ex.toString());
180 public java.lang.Object newInstance(java.lang.Object parent) {
184 desc.setHandler(handler);
185 desc.setMultivalued(false);
186 addFieldDescriptor(desc);
188 //-- validation code for: _minColour
189 fieldValidator = new org.exolab.castor.xml.FieldValidator();
191 org.exolab.castor.xml.validators.IntValidator typeValidator;
192 typeValidator = new org.exolab.castor.xml.validators.IntValidator();
193 fieldValidator.setValidator(typeValidator);
194 typeValidator.setMinInclusive(-2147483648);
195 typeValidator.setMaxInclusive(2147483647);
197 desc.setValidator(fieldValidator);
199 desc = new org.exolab.castor.xml.util.XMLFieldDescriptorImpl(java.lang.Integer.TYPE, "_maxColour", "maxColour", org.exolab.castor.xml.NodeType.Attribute);
200 handler = new org.exolab.castor.xml.XMLFieldHandler() {
201 public java.lang.Object getValue( java.lang.Object object )
202 throws IllegalStateException
204 AnnotationColours target = (AnnotationColours) object;
205 if (!target.hasMaxColour()) { return null; }
206 return new java.lang.Integer(target.getMaxColour());
208 public void setValue( java.lang.Object object, java.lang.Object value)
209 throws IllegalStateException, IllegalArgumentException
212 AnnotationColours target = (AnnotationColours) object;
213 // if null, use delete method for optional primitives
215 target.deleteMaxColour();
218 target.setMaxColour( ((java.lang.Integer) value).intValue());
219 } catch (java.lang.Exception ex) {
220 throw new IllegalStateException(ex.toString());
223 public java.lang.Object newInstance(java.lang.Object parent) {
227 desc.setHandler(handler);
228 desc.setMultivalued(false);
229 addFieldDescriptor(desc);
231 //-- validation code for: _maxColour
232 fieldValidator = new org.exolab.castor.xml.FieldValidator();
234 org.exolab.castor.xml.validators.IntValidator typeValidator;
235 typeValidator = new org.exolab.castor.xml.validators.IntValidator();
236 fieldValidator.setValidator(typeValidator);
237 typeValidator.setMinInclusive(-2147483648);
238 typeValidator.setMaxInclusive(2147483647);
240 desc.setValidator(fieldValidator);
242 desc = new org.exolab.castor.xml.util.XMLFieldDescriptorImpl(java.lang.String.class, "_colourScheme", "colourScheme", org.exolab.castor.xml.NodeType.Attribute);
243 desc.setImmutable(true);
244 handler = new org.exolab.castor.xml.XMLFieldHandler() {
245 public java.lang.Object getValue( java.lang.Object object )
246 throws IllegalStateException
248 AnnotationColours target = (AnnotationColours) object;
249 return target.getColourScheme();
251 public void setValue( java.lang.Object object, java.lang.Object value)
252 throws IllegalStateException, IllegalArgumentException
255 AnnotationColours target = (AnnotationColours) object;
256 target.setColourScheme( (java.lang.String) value);
257 } catch (java.lang.Exception ex) {
258 throw new IllegalStateException(ex.toString());
261 public java.lang.Object newInstance(java.lang.Object parent) {
265 desc.setHandler(handler);
266 desc.setMultivalued(false);
267 addFieldDescriptor(desc);
269 //-- validation code for: _colourScheme
270 fieldValidator = new org.exolab.castor.xml.FieldValidator();
272 org.exolab.castor.xml.validators.StringValidator typeValidator;
273 typeValidator = new org.exolab.castor.xml.validators.StringValidator();
274 fieldValidator.setValidator(typeValidator);
275 typeValidator.setWhiteSpace("preserve");
277 desc.setValidator(fieldValidator);
279 desc = new org.exolab.castor.xml.util.XMLFieldDescriptorImpl(java.lang.Float.TYPE, "_threshold", "threshold", org.exolab.castor.xml.NodeType.Attribute);
280 handler = new org.exolab.castor.xml.XMLFieldHandler() {
281 public java.lang.Object getValue( java.lang.Object object )
282 throws IllegalStateException
284 AnnotationColours target = (AnnotationColours) object;
285 if (!target.hasThreshold()) { return null; }
286 return new java.lang.Float(target.getThreshold());
288 public void setValue( java.lang.Object object, java.lang.Object value)
289 throws IllegalStateException, IllegalArgumentException
292 AnnotationColours target = (AnnotationColours) object;
293 // if null, use delete method for optional primitives
295 target.deleteThreshold();
298 target.setThreshold( ((java.lang.Float) value).floatValue());
299 } catch (java.lang.Exception ex) {
300 throw new IllegalStateException(ex.toString());
303 public java.lang.Object newInstance(java.lang.Object parent) {
307 desc.setHandler(handler);
308 desc.setMultivalued(false);
309 addFieldDescriptor(desc);
311 //-- validation code for: _threshold
312 fieldValidator = new org.exolab.castor.xml.FieldValidator();
314 org.exolab.castor.xml.validators.FloatValidator typeValidator;
315 typeValidator = new org.exolab.castor.xml.validators.FloatValidator();
316 fieldValidator.setValidator(typeValidator);
317 typeValidator.setMinInclusive((float) -3.4028235E38);
318 typeValidator.setMaxInclusive((float) 3.4028235E38);
320 desc.setValidator(fieldValidator);
322 desc = new org.exolab.castor.xml.util.XMLFieldDescriptorImpl(java.lang.Boolean.TYPE, "_perSequence", "perSequence", org.exolab.castor.xml.NodeType.Attribute);
323 handler = new org.exolab.castor.xml.XMLFieldHandler() {
324 public java.lang.Object getValue( java.lang.Object object )
325 throws IllegalStateException
327 AnnotationColours target = (AnnotationColours) object;
328 if (!target.hasPerSequence()) { return null; }
329 return (target.getPerSequence() ? java.lang.Boolean.TRUE : java.lang.Boolean.FALSE);
331 public void setValue( java.lang.Object object, java.lang.Object value)
332 throws IllegalStateException, IllegalArgumentException
335 AnnotationColours target = (AnnotationColours) object;
336 // if null, use delete method for optional primitives
338 target.deletePerSequence();
341 target.setPerSequence( ((java.lang.Boolean) value).booleanValue());
342 } catch (java.lang.Exception ex) {
343 throw new IllegalStateException(ex.toString());
346 public java.lang.Object newInstance(java.lang.Object parent) {
350 desc.setHandler(handler);
351 desc.setMultivalued(false);
352 addFieldDescriptor(desc);
354 //-- validation code for: _perSequence
355 fieldValidator = new org.exolab.castor.xml.FieldValidator();
357 org.exolab.castor.xml.validators.BooleanValidator typeValidator;
358 typeValidator = new org.exolab.castor.xml.validators.BooleanValidator();
359 fieldValidator.setValidator(typeValidator);
361 desc.setValidator(fieldValidator);
362 //-- _predefinedColours
363 desc = new org.exolab.castor.xml.util.XMLFieldDescriptorImpl(java.lang.Boolean.TYPE, "_predefinedColours", "predefinedColours", org.exolab.castor.xml.NodeType.Attribute);
364 handler = new org.exolab.castor.xml.XMLFieldHandler() {
365 public java.lang.Object getValue( java.lang.Object object )
366 throws IllegalStateException
368 AnnotationColours target = (AnnotationColours) object;
369 if (!target.hasPredefinedColours()) { return null; }
370 return (target.getPredefinedColours() ? java.lang.Boolean.TRUE : java.lang.Boolean.FALSE);
372 public void setValue( java.lang.Object object, java.lang.Object value)
373 throws IllegalStateException, IllegalArgumentException
376 AnnotationColours target = (AnnotationColours) object;
377 // if null, use delete method for optional primitives
379 target.deletePredefinedColours();
382 target.setPredefinedColours( ((java.lang.Boolean) value).booleanValue());
383 } catch (java.lang.Exception ex) {
384 throw new IllegalStateException(ex.toString());
387 public java.lang.Object newInstance(java.lang.Object parent) {
391 desc.setHandler(handler);
392 desc.setMultivalued(false);
393 addFieldDescriptor(desc);
395 //-- validation code for: _predefinedColours
396 fieldValidator = new org.exolab.castor.xml.FieldValidator();
398 org.exolab.castor.xml.validators.BooleanValidator typeValidator;
399 typeValidator = new org.exolab.castor.xml.validators.BooleanValidator();
400 fieldValidator.setValidator(typeValidator);
402 desc.setValidator(fieldValidator);
403 //-- initialize element descriptors
413 * Method getAccessMode.
415 * @return the access mode specified for this class.
417 public org.exolab.castor.mapping.AccessMode getAccessMode(
423 * Method getIdentity.
425 * @return the identity field, null if this class has no
428 public org.exolab.castor.mapping.FieldDescriptor getIdentity(
430 return super.getIdentity();
434 * Method getJavaClass.
436 * @return the Java class represented by this descriptor.
438 public java.lang.Class getJavaClass(
440 return jalview.schemabinding.version2.AnnotationColours.class;
444 * Method getNameSpacePrefix.
446 * @return the namespace prefix to use when marshaling as XML.
448 public java.lang.String getNameSpacePrefix(
454 * Method getNameSpaceURI.
456 * @return the namespace URI used when marshaling and
457 * unmarshaling as XML.
459 public java.lang.String getNameSpaceURI(
465 * Method getValidator.
467 * @return a specific validator for the class described by this
470 public org.exolab.castor.xml.TypeValidator getValidator(
478 * @return the XML Name for the Class being described.
480 public java.lang.String getXMLName(
486 * Method isElementDefinition.
488 * @return true if XML schema definition of this Class is that
490 * element or element with anonymous type definition.
492 public boolean isElementDefinition(
494 return _elementDefinition;