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.Alcodon;
30 * Class AlcodonDescriptor.
32 * @version $Revision$ $Date$
34 public class AlcodonDescriptor 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 AlcodonDescriptor()
69 _nsURI = "www.vamsas.ac.uk/jalview/version2";
71 _elementDefinition = true;
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.Long.TYPE, "_pos1", "pos1",
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 Alcodon target = (Alcodon) object;
87 if (!target.hasPos1())
91 return new java.lang.Long(target.getPos1());
94 public void setValue(java.lang.Object object, java.lang.Object value)
95 throws IllegalStateException, IllegalArgumentException
99 Alcodon target = (Alcodon) object;
100 // if null, use delete method for optional primitives
106 target.setPos1(((java.lang.Long) value).longValue());
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: _pos1
123 fieldValidator = new org.exolab.castor.xml.FieldValidator();
125 org.exolab.castor.xml.validators.LongValidator typeValidator;
126 typeValidator = new org.exolab.castor.xml.validators.LongValidator();
127 fieldValidator.setValidator(typeValidator);
129 desc.setValidator(fieldValidator);
131 desc = new org.exolab.castor.xml.util.XMLFieldDescriptorImpl(
132 java.lang.Long.TYPE, "_pos2", "pos2",
133 org.exolab.castor.xml.NodeType.Attribute);
134 handler = new org.exolab.castor.xml.XMLFieldHandler()
136 public java.lang.Object getValue(java.lang.Object object)
137 throws IllegalStateException
139 Alcodon target = (Alcodon) object;
140 if (!target.hasPos2())
144 return new java.lang.Long(target.getPos2());
147 public void setValue(java.lang.Object object, java.lang.Object value)
148 throws IllegalStateException, IllegalArgumentException
152 Alcodon target = (Alcodon) object;
153 // if null, use delete method for optional primitives
159 target.setPos2(((java.lang.Long) value).longValue());
160 } catch (java.lang.Exception ex)
162 throw new IllegalStateException(ex.toString());
166 public java.lang.Object newInstance(java.lang.Object parent)
171 desc.setHandler(handler);
172 desc.setMultivalued(false);
173 addFieldDescriptor(desc);
175 // -- validation code for: _pos2
176 fieldValidator = new org.exolab.castor.xml.FieldValidator();
178 org.exolab.castor.xml.validators.LongValidator typeValidator;
179 typeValidator = new org.exolab.castor.xml.validators.LongValidator();
180 fieldValidator.setValidator(typeValidator);
182 desc.setValidator(fieldValidator);
184 desc = new org.exolab.castor.xml.util.XMLFieldDescriptorImpl(
185 java.lang.Long.TYPE, "_pos3", "pos3",
186 org.exolab.castor.xml.NodeType.Attribute);
187 handler = new org.exolab.castor.xml.XMLFieldHandler()
189 public java.lang.Object getValue(java.lang.Object object)
190 throws IllegalStateException
192 Alcodon target = (Alcodon) object;
193 if (!target.hasPos3())
197 return new java.lang.Long(target.getPos3());
200 public void setValue(java.lang.Object object, java.lang.Object value)
201 throws IllegalStateException, IllegalArgumentException
205 Alcodon target = (Alcodon) object;
206 // if null, use delete method for optional primitives
212 target.setPos3(((java.lang.Long) value).longValue());
213 } catch (java.lang.Exception ex)
215 throw new IllegalStateException(ex.toString());
219 public java.lang.Object newInstance(java.lang.Object parent)
224 desc.setHandler(handler);
225 desc.setMultivalued(false);
226 addFieldDescriptor(desc);
228 // -- validation code for: _pos3
229 fieldValidator = new org.exolab.castor.xml.FieldValidator();
231 org.exolab.castor.xml.validators.LongValidator typeValidator;
232 typeValidator = new org.exolab.castor.xml.validators.LongValidator();
233 fieldValidator.setValidator(typeValidator);
235 desc.setValidator(fieldValidator);
236 // -- initialize element descriptors
245 * Method getAccessMode.
247 * @return the access mode specified for this class.
249 public org.exolab.castor.mapping.AccessMode getAccessMode()
255 * Method getIdentity.
257 * @return the identity field, null if this class has no identity.
259 public org.exolab.castor.mapping.FieldDescriptor getIdentity()
261 return super.getIdentity();
265 * Method getJavaClass.
267 * @return the Java class represented by this descriptor.
269 public java.lang.Class getJavaClass()
271 return jalview.schemabinding.version2.Alcodon.class;
275 * Method getNameSpacePrefix.
277 * @return the namespace prefix to use when marshaling as XML.
279 public java.lang.String getNameSpacePrefix()
285 * Method getNameSpaceURI.
287 * @return the namespace URI used when marshaling and unmarshaling as XML.
289 public java.lang.String getNameSpaceURI()
295 * Method getValidator.
297 * @return a specific validator for the class described by this
300 public org.exolab.castor.xml.TypeValidator getValidator()
308 * @return the XML Name for the Class being described.
310 public java.lang.String getXMLName()
316 * Method isElementDefinition.
318 * @return true if XML schema definition of this Class is that of a global
319 * element or element with anonymous type definition.
321 public boolean isElementDefinition()
323 return _elementDefinition;