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.
19 package jalview.schemabinding.version2.descriptors;
21 //---------------------------------/
22 //- Imported classes and packages -/
23 //---------------------------------/
25 import jalview.schemabinding.version2.Alcodon;
28 * Class AlcodonDescriptor.
30 * @version $Revision$ $Date$
32 public class AlcodonDescriptor extends
33 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;
64 public AlcodonDescriptor()
67 _nsURI = "www.vamsas.ac.uk/jalview/version2";
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(
77 java.lang.Long.TYPE, "_pos1", "pos1",
78 org.exolab.castor.xml.NodeType.Attribute);
79 handler = new org.exolab.castor.xml.XMLFieldHandler()
81 public java.lang.Object getValue(java.lang.Object object)
82 throws IllegalStateException
84 Alcodon target = (Alcodon) object;
85 if (!target.hasPos1())
89 return new java.lang.Long(target.getPos1());
92 public void setValue(java.lang.Object object, java.lang.Object value)
93 throws IllegalStateException, IllegalArgumentException
97 Alcodon target = (Alcodon) object;
98 // if null, use delete method for optional primitives
104 target.setPos1(((java.lang.Long) value).longValue());
105 } catch (java.lang.Exception ex)
107 throw new IllegalStateException(ex.toString());
111 public java.lang.Object newInstance(java.lang.Object parent)
116 desc.setHandler(handler);
117 desc.setMultivalued(false);
118 addFieldDescriptor(desc);
120 // -- validation code for: _pos1
121 fieldValidator = new org.exolab.castor.xml.FieldValidator();
123 org.exolab.castor.xml.validators.LongValidator typeValidator;
124 typeValidator = new org.exolab.castor.xml.validators.LongValidator();
125 fieldValidator.setValidator(typeValidator);
127 desc.setValidator(fieldValidator);
129 desc = new org.exolab.castor.xml.util.XMLFieldDescriptorImpl(
130 java.lang.Long.TYPE, "_pos2", "pos2",
131 org.exolab.castor.xml.NodeType.Attribute);
132 handler = new org.exolab.castor.xml.XMLFieldHandler()
134 public java.lang.Object getValue(java.lang.Object object)
135 throws IllegalStateException
137 Alcodon target = (Alcodon) object;
138 if (!target.hasPos2())
142 return new java.lang.Long(target.getPos2());
145 public void setValue(java.lang.Object object, java.lang.Object value)
146 throws IllegalStateException, IllegalArgumentException
150 Alcodon target = (Alcodon) object;
151 // if null, use delete method for optional primitives
157 target.setPos2(((java.lang.Long) value).longValue());
158 } catch (java.lang.Exception ex)
160 throw new IllegalStateException(ex.toString());
164 public java.lang.Object newInstance(java.lang.Object parent)
169 desc.setHandler(handler);
170 desc.setMultivalued(false);
171 addFieldDescriptor(desc);
173 // -- validation code for: _pos2
174 fieldValidator = new org.exolab.castor.xml.FieldValidator();
176 org.exolab.castor.xml.validators.LongValidator typeValidator;
177 typeValidator = new org.exolab.castor.xml.validators.LongValidator();
178 fieldValidator.setValidator(typeValidator);
180 desc.setValidator(fieldValidator);
182 desc = new org.exolab.castor.xml.util.XMLFieldDescriptorImpl(
183 java.lang.Long.TYPE, "_pos3", "pos3",
184 org.exolab.castor.xml.NodeType.Attribute);
185 handler = new org.exolab.castor.xml.XMLFieldHandler()
187 public java.lang.Object getValue(java.lang.Object object)
188 throws IllegalStateException
190 Alcodon target = (Alcodon) object;
191 if (!target.hasPos3())
195 return new java.lang.Long(target.getPos3());
198 public void setValue(java.lang.Object object, java.lang.Object value)
199 throws IllegalStateException, IllegalArgumentException
203 Alcodon target = (Alcodon) object;
204 // if null, use delete method for optional primitives
210 target.setPos3(((java.lang.Long) value).longValue());
211 } catch (java.lang.Exception ex)
213 throw new IllegalStateException(ex.toString());
217 public java.lang.Object newInstance(java.lang.Object parent)
222 desc.setHandler(handler);
223 desc.setMultivalued(false);
224 addFieldDescriptor(desc);
226 // -- validation code for: _pos3
227 fieldValidator = new org.exolab.castor.xml.FieldValidator();
229 org.exolab.castor.xml.validators.LongValidator typeValidator;
230 typeValidator = new org.exolab.castor.xml.validators.LongValidator();
231 fieldValidator.setValidator(typeValidator);
233 desc.setValidator(fieldValidator);
234 // -- initialize element descriptors
243 * Method getAccessMode.
245 * @return the access mode specified for this class.
247 public org.exolab.castor.mapping.AccessMode getAccessMode()
253 * Method getIdentity.
255 * @return the identity field, null if this class has no identity.
257 public org.exolab.castor.mapping.FieldDescriptor getIdentity()
259 return super.getIdentity();
263 * Method getJavaClass.
265 * @return the Java class represented by this descriptor.
267 public java.lang.Class getJavaClass()
269 return jalview.schemabinding.version2.Alcodon.class;
273 * Method getNameSpacePrefix.
275 * @return the namespace prefix to use when marshaling as XML.
277 public java.lang.String getNameSpacePrefix()
283 * Method getNameSpaceURI.
285 * @return the namespace URI used when marshaling and unmarshaling as XML.
287 public java.lang.String getNameSpaceURI()
293 * Method getValidator.
295 * @return a specific validator for the class described by this
298 public org.exolab.castor.xml.TypeValidator getValidator()
306 * @return the XML Name for the Class being described.
308 public java.lang.String getXMLName()
314 * Method isElementDefinition.
316 * @return true if XML schema definition of this Class is that of a global
317 * element or element with anonymous type definition.
319 public boolean isElementDefinition()
321 return _elementDefinition;