1 /*******************************************************************************
2 * Jalview - A Sequence Alignment Editor and Viewer (Version 2.7)
3 * Copyright (C) 2011 J Procter, AM Waterhouse, J Engelhardt, LM Lui, 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/>.
17 *******************************************************************************/
19 * This class was automatically generated with
20 * <a href="http://www.castor.org">Castor 1.1</a>, using an XML
25 package jalview.schemabinding.version2.descriptors;
27 //---------------------------------/
28 //- Imported classes and packages -/
29 //---------------------------------/
31 import jalview.schemabinding.version2.AnnotationElement;
34 * Class AnnotationElementDescriptor.
36 * @version $Revision$ $Date$
38 public class AnnotationElementDescriptor extends org.exolab.castor.xml.util.XMLClassDescriptorImpl {
41 //--------------------------/
42 //- Class/Member Variables -/
43 //--------------------------/
46 * Field _elementDefinition.
48 private boolean _elementDefinition;
53 private java.lang.String _nsPrefix;
58 private java.lang.String _nsURI;
63 private java.lang.String _xmlName;
70 public AnnotationElementDescriptor() {
72 _nsURI = "www.vamsas.ac.uk/jalview/version2";
73 _xmlName = "annotationElement";
74 _elementDefinition = true;
76 //-- set grouping compositor
77 setCompositorAsSequence();
78 org.exolab.castor.xml.util.XMLFieldDescriptorImpl desc = null;
79 org.exolab.castor.mapping.FieldHandler handler = null;
80 org.exolab.castor.xml.FieldValidator fieldValidator = null;
81 //-- initialize attribute descriptors
84 desc = new org.exolab.castor.xml.util.XMLFieldDescriptorImpl(java.lang.Integer.TYPE, "_position", "position", org.exolab.castor.xml.NodeType.Attribute);
85 handler = new org.exolab.castor.xml.XMLFieldHandler() {
86 public java.lang.Object getValue( java.lang.Object object )
87 throws IllegalStateException
89 AnnotationElement target = (AnnotationElement) object;
90 if (!target.hasPosition()) { return null; }
91 return new java.lang.Integer(target.getPosition());
93 public void setValue( java.lang.Object object, java.lang.Object value)
94 throws IllegalStateException, IllegalArgumentException
97 AnnotationElement target = (AnnotationElement) object;
98 // ignore null values for non optional primitives
99 if (value == null) { return; }
101 target.setPosition( ((java.lang.Integer) value).intValue());
102 } catch (java.lang.Exception ex) {
103 throw new IllegalStateException(ex.toString());
106 public java.lang.Object newInstance(java.lang.Object parent) {
110 desc.setHandler(handler);
111 desc.setRequired(true);
112 desc.setMultivalued(false);
113 addFieldDescriptor(desc);
115 //-- validation code for: _position
116 fieldValidator = new org.exolab.castor.xml.FieldValidator();
117 fieldValidator.setMinOccurs(1);
119 org.exolab.castor.xml.validators.IntValidator typeValidator;
120 typeValidator = new org.exolab.castor.xml.validators.IntValidator();
121 fieldValidator.setValidator(typeValidator);
122 typeValidator.setMinInclusive(-2147483648);
123 typeValidator.setMaxInclusive(2147483647);
125 desc.setValidator(fieldValidator);
127 desc = new org.exolab.castor.xml.util.XMLFieldDescriptorImpl(java.lang.Integer.TYPE, "_colour", "colour", org.exolab.castor.xml.NodeType.Attribute);
128 handler = new org.exolab.castor.xml.XMLFieldHandler() {
129 public java.lang.Object getValue( java.lang.Object object )
130 throws IllegalStateException
132 AnnotationElement target = (AnnotationElement) object;
133 if (!target.hasColour()) { return null; }
134 return new java.lang.Integer(target.getColour());
136 public void setValue( java.lang.Object object, java.lang.Object value)
137 throws IllegalStateException, IllegalArgumentException
140 AnnotationElement target = (AnnotationElement) object;
141 // if null, use delete method for optional primitives
143 target.deleteColour();
146 target.setColour( ((java.lang.Integer) value).intValue());
147 } catch (java.lang.Exception ex) {
148 throw new IllegalStateException(ex.toString());
151 public java.lang.Object newInstance(java.lang.Object parent) {
155 desc.setHandler(handler);
156 desc.setMultivalued(false);
157 addFieldDescriptor(desc);
159 //-- validation code for: _colour
160 fieldValidator = new org.exolab.castor.xml.FieldValidator();
162 org.exolab.castor.xml.validators.IntValidator typeValidator;
163 typeValidator = new org.exolab.castor.xml.validators.IntValidator();
164 fieldValidator.setValidator(typeValidator);
165 typeValidator.setMinInclusive(-2147483648);
166 typeValidator.setMaxInclusive(2147483647);
168 desc.setValidator(fieldValidator);
169 //-- initialize element descriptors
171 //-- _displayCharacter
172 desc = new org.exolab.castor.xml.util.XMLFieldDescriptorImpl(java.lang.String.class, "_displayCharacter", "displayCharacter", org.exolab.castor.xml.NodeType.Element);
173 desc.setImmutable(true);
174 handler = new org.exolab.castor.xml.XMLFieldHandler() {
175 public java.lang.Object getValue( java.lang.Object object )
176 throws IllegalStateException
178 AnnotationElement target = (AnnotationElement) object;
179 return target.getDisplayCharacter();
181 public void setValue( java.lang.Object object, java.lang.Object value)
182 throws IllegalStateException, IllegalArgumentException
185 AnnotationElement target = (AnnotationElement) object;
186 target.setDisplayCharacter( (java.lang.String) value);
187 } catch (java.lang.Exception ex) {
188 throw new IllegalStateException(ex.toString());
191 public java.lang.Object newInstance(java.lang.Object parent) {
195 desc.setHandler(handler);
196 desc.setNameSpaceURI("www.vamsas.ac.uk/jalview/version2");
197 desc.setMultivalued(false);
198 addFieldDescriptor(desc);
200 //-- validation code for: _displayCharacter
201 fieldValidator = new org.exolab.castor.xml.FieldValidator();
203 org.exolab.castor.xml.validators.StringValidator typeValidator;
204 typeValidator = new org.exolab.castor.xml.validators.StringValidator();
205 fieldValidator.setValidator(typeValidator);
206 typeValidator.setWhiteSpace("preserve");
208 desc.setValidator(fieldValidator);
210 desc = new org.exolab.castor.xml.util.XMLFieldDescriptorImpl(java.lang.String.class, "_description", "description", org.exolab.castor.xml.NodeType.Element);
211 desc.setImmutable(true);
212 handler = new org.exolab.castor.xml.XMLFieldHandler() {
213 public java.lang.Object getValue( java.lang.Object object )
214 throws IllegalStateException
216 AnnotationElement target = (AnnotationElement) object;
217 return target.getDescription();
219 public void setValue( java.lang.Object object, java.lang.Object value)
220 throws IllegalStateException, IllegalArgumentException
223 AnnotationElement target = (AnnotationElement) object;
224 target.setDescription( (java.lang.String) value);
225 } catch (java.lang.Exception ex) {
226 throw new IllegalStateException(ex.toString());
229 public java.lang.Object newInstance(java.lang.Object parent) {
233 desc.setHandler(handler);
234 desc.setNameSpaceURI("www.vamsas.ac.uk/jalview/version2");
235 desc.setMultivalued(false);
236 addFieldDescriptor(desc);
238 //-- validation code for: _description
239 fieldValidator = new org.exolab.castor.xml.FieldValidator();
241 org.exolab.castor.xml.validators.StringValidator typeValidator;
242 typeValidator = new org.exolab.castor.xml.validators.StringValidator();
243 fieldValidator.setValidator(typeValidator);
244 typeValidator.setWhiteSpace("preserve");
246 desc.setValidator(fieldValidator);
247 //-- _secondaryStructure
248 desc = new org.exolab.castor.xml.util.XMLFieldDescriptorImpl(java.lang.String.class, "_secondaryStructure", "secondaryStructure", org.exolab.castor.xml.NodeType.Element);
249 desc.setImmutable(true);
250 handler = new org.exolab.castor.xml.XMLFieldHandler() {
251 public java.lang.Object getValue( java.lang.Object object )
252 throws IllegalStateException
254 AnnotationElement target = (AnnotationElement) object;
255 return target.getSecondaryStructure();
257 public void setValue( java.lang.Object object, java.lang.Object value)
258 throws IllegalStateException, IllegalArgumentException
261 AnnotationElement target = (AnnotationElement) object;
262 target.setSecondaryStructure( (java.lang.String) value);
263 } catch (java.lang.Exception ex) {
264 throw new IllegalStateException(ex.toString());
267 public java.lang.Object newInstance(java.lang.Object parent) {
271 desc.setHandler(handler);
272 desc.setNameSpaceURI("www.vamsas.ac.uk/jalview/version2");
273 desc.setMultivalued(false);
274 addFieldDescriptor(desc);
276 //-- validation code for: _secondaryStructure
277 fieldValidator = new org.exolab.castor.xml.FieldValidator();
279 org.exolab.castor.xml.validators.StringValidator typeValidator;
280 typeValidator = new org.exolab.castor.xml.validators.StringValidator();
281 fieldValidator.setValidator(typeValidator);
282 typeValidator.setWhiteSpace("preserve");
283 typeValidator.setLength(1);
285 desc.setValidator(fieldValidator);
287 desc = new org.exolab.castor.xml.util.XMLFieldDescriptorImpl(java.lang.Float.TYPE, "_value", "value", org.exolab.castor.xml.NodeType.Element);
288 handler = new org.exolab.castor.xml.XMLFieldHandler() {
289 public java.lang.Object getValue( java.lang.Object object )
290 throws IllegalStateException
292 AnnotationElement target = (AnnotationElement) object;
293 if (!target.hasValue()) { return null; }
294 return new java.lang.Float(target.getValue());
296 public void setValue( java.lang.Object object, java.lang.Object value)
297 throws IllegalStateException, IllegalArgumentException
300 AnnotationElement target = (AnnotationElement) object;
301 // if null, use delete method for optional primitives
303 target.deleteValue();
306 target.setValue( ((java.lang.Float) value).floatValue());
307 } catch (java.lang.Exception ex) {
308 throw new IllegalStateException(ex.toString());
311 public java.lang.Object newInstance(java.lang.Object parent) {
315 desc.setHandler(handler);
316 desc.setNameSpaceURI("www.vamsas.ac.uk/jalview/version2");
317 desc.setMultivalued(false);
318 addFieldDescriptor(desc);
320 //-- validation code for: _value
321 fieldValidator = new org.exolab.castor.xml.FieldValidator();
323 org.exolab.castor.xml.validators.FloatValidator typeValidator;
324 typeValidator = new org.exolab.castor.xml.validators.FloatValidator();
325 fieldValidator.setValidator(typeValidator);
326 typeValidator.setMinInclusive((float) -3.4028235E38);
327 typeValidator.setMaxInclusive((float) 3.4028235E38);
329 desc.setValidator(fieldValidator);
338 * Method getAccessMode.
340 * @return the access mode specified for this class.
342 public org.exolab.castor.mapping.AccessMode getAccessMode(
348 * Method getIdentity.
350 * @return the identity field, null if this class has no
353 public org.exolab.castor.mapping.FieldDescriptor getIdentity(
355 return super.getIdentity();
359 * Method getJavaClass.
361 * @return the Java class represented by this descriptor.
363 public java.lang.Class getJavaClass(
365 return jalview.schemabinding.version2.AnnotationElement.class;
369 * Method getNameSpacePrefix.
371 * @return the namespace prefix to use when marshaling as XML.
373 public java.lang.String getNameSpacePrefix(
379 * Method getNameSpaceURI.
381 * @return the namespace URI used when marshaling and
382 * unmarshaling as XML.
384 public java.lang.String getNameSpaceURI(
390 * Method getValidator.
392 * @return a specific validator for the class described by this
395 public org.exolab.castor.xml.TypeValidator getValidator(
403 * @return the XML Name for the Class being described.
405 public java.lang.String getXMLName(
411 * Method isElementDefinition.
413 * @return true if XML schema definition of this Class is that
415 * element or element with anonymous type definition.
417 public boolean isElementDefinition(
419 return _elementDefinition;