2 * Jalview - A Sequence Alignment Editor and Viewer (Version 2.8)
3 * Copyright (C) 2012 J Procter, AM Waterhouse, LM Lui, J Engelhardt, 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/>.
18 package jalview.schemabinding.version2.descriptors;
20 //---------------------------------/
21 //- Imported classes and packages -/
22 //---------------------------------/
24 import jalview.schemabinding.version2.Alcodon;
27 * Class AlcodonDescriptor.
29 * @version $Revision$ $Date$
31 public class AlcodonDescriptor extends
32 org.exolab.castor.xml.util.XMLClassDescriptorImpl
35 // --------------------------/
36 // - Class/Member Variables -/
37 // --------------------------/
40 * Field _elementDefinition.
42 private boolean _elementDefinition;
47 private java.lang.String _nsPrefix;
52 private java.lang.String _nsURI;
57 private java.lang.String _xmlName;
63 public AlcodonDescriptor()
66 _nsURI = "www.vamsas.ac.uk/jalview/version2";
68 _elementDefinition = true;
69 org.exolab.castor.xml.util.XMLFieldDescriptorImpl desc = null;
70 org.exolab.castor.mapping.FieldHandler handler = null;
71 org.exolab.castor.xml.FieldValidator fieldValidator = null;
72 // -- initialize attribute descriptors
75 desc = new org.exolab.castor.xml.util.XMLFieldDescriptorImpl(
76 java.lang.Long.TYPE, "_pos1", "pos1",
77 org.exolab.castor.xml.NodeType.Attribute);
78 handler = new org.exolab.castor.xml.XMLFieldHandler()
80 public java.lang.Object getValue(java.lang.Object object)
81 throws IllegalStateException
83 Alcodon target = (Alcodon) object;
84 if (!target.hasPos1())
88 return new java.lang.Long(target.getPos1());
91 public void setValue(java.lang.Object object, java.lang.Object value)
92 throws IllegalStateException, IllegalArgumentException
96 Alcodon target = (Alcodon) object;
97 // if null, use delete method for optional primitives
103 target.setPos1(((java.lang.Long) value).longValue());
104 } catch (java.lang.Exception ex)
106 throw new IllegalStateException(ex.toString());
110 public java.lang.Object newInstance(java.lang.Object parent)
115 desc.setHandler(handler);
116 desc.setMultivalued(false);
117 addFieldDescriptor(desc);
119 // -- validation code for: _pos1
120 fieldValidator = new org.exolab.castor.xml.FieldValidator();
122 org.exolab.castor.xml.validators.LongValidator typeValidator;
123 typeValidator = new org.exolab.castor.xml.validators.LongValidator();
124 fieldValidator.setValidator(typeValidator);
126 desc.setValidator(fieldValidator);
128 desc = new org.exolab.castor.xml.util.XMLFieldDescriptorImpl(
129 java.lang.Long.TYPE, "_pos2", "pos2",
130 org.exolab.castor.xml.NodeType.Attribute);
131 handler = new org.exolab.castor.xml.XMLFieldHandler()
133 public java.lang.Object getValue(java.lang.Object object)
134 throws IllegalStateException
136 Alcodon target = (Alcodon) object;
137 if (!target.hasPos2())
141 return new java.lang.Long(target.getPos2());
144 public void setValue(java.lang.Object object, java.lang.Object value)
145 throws IllegalStateException, IllegalArgumentException
149 Alcodon target = (Alcodon) object;
150 // if null, use delete method for optional primitives
156 target.setPos2(((java.lang.Long) value).longValue());
157 } catch (java.lang.Exception ex)
159 throw new IllegalStateException(ex.toString());
163 public java.lang.Object newInstance(java.lang.Object parent)
168 desc.setHandler(handler);
169 desc.setMultivalued(false);
170 addFieldDescriptor(desc);
172 // -- validation code for: _pos2
173 fieldValidator = new org.exolab.castor.xml.FieldValidator();
175 org.exolab.castor.xml.validators.LongValidator typeValidator;
176 typeValidator = new org.exolab.castor.xml.validators.LongValidator();
177 fieldValidator.setValidator(typeValidator);
179 desc.setValidator(fieldValidator);
181 desc = new org.exolab.castor.xml.util.XMLFieldDescriptorImpl(
182 java.lang.Long.TYPE, "_pos3", "pos3",
183 org.exolab.castor.xml.NodeType.Attribute);
184 handler = new org.exolab.castor.xml.XMLFieldHandler()
186 public java.lang.Object getValue(java.lang.Object object)
187 throws IllegalStateException
189 Alcodon target = (Alcodon) object;
190 if (!target.hasPos3())
194 return new java.lang.Long(target.getPos3());
197 public void setValue(java.lang.Object object, java.lang.Object value)
198 throws IllegalStateException, IllegalArgumentException
202 Alcodon target = (Alcodon) object;
203 // if null, use delete method for optional primitives
209 target.setPos3(((java.lang.Long) value).longValue());
210 } catch (java.lang.Exception ex)
212 throw new IllegalStateException(ex.toString());
216 public java.lang.Object newInstance(java.lang.Object parent)
221 desc.setHandler(handler);
222 desc.setMultivalued(false);
223 addFieldDescriptor(desc);
225 // -- validation code for: _pos3
226 fieldValidator = new org.exolab.castor.xml.FieldValidator();
228 org.exolab.castor.xml.validators.LongValidator typeValidator;
229 typeValidator = new org.exolab.castor.xml.validators.LongValidator();
230 fieldValidator.setValidator(typeValidator);
232 desc.setValidator(fieldValidator);
233 // -- initialize element descriptors
242 * Method getAccessMode.
244 * @return the access mode specified for this class.
246 public org.exolab.castor.mapping.AccessMode getAccessMode()
252 * Method getIdentity.
254 * @return the identity field, null if this class has no identity.
256 public org.exolab.castor.mapping.FieldDescriptor getIdentity()
258 return super.getIdentity();
262 * Method getJavaClass.
264 * @return the Java class represented by this descriptor.
266 public java.lang.Class getJavaClass()
268 return jalview.schemabinding.version2.Alcodon.class;
272 * Method getNameSpacePrefix.
274 * @return the namespace prefix to use when marshaling as XML.
276 public java.lang.String getNameSpacePrefix()
282 * Method getNameSpaceURI.
284 * @return the namespace URI used when marshaling and unmarshaling as XML.
286 public java.lang.String getNameSpaceURI()
292 * Method getValidator.
294 * @return a specific validator for the class described by this
297 public org.exolab.castor.xml.TypeValidator getValidator()
305 * @return the XML Name for the Class being described.
307 public java.lang.String getXMLName()
313 * Method isElementDefinition.
315 * @return true if XML schema definition of this Class is that of a global
316 * element or element with anonymous type definition.
318 public boolean isElementDefinition()
320 return _elementDefinition;