8e6864f7570970cb48522bae51539a7bc95eebb4
[jalview.git] / src / jalview / schemabinding / version2 / descriptors / AlcodonDescriptor.java
1 /*
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
4  * 
5  * This file is part of Jalview.
6  * 
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.
10  *  
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.
15  * 
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  */
18 package jalview.schemabinding.version2.descriptors;
19
20 //---------------------------------/
21 //- Imported classes and packages -/
22 //---------------------------------/
23
24 import jalview.schemabinding.version2.Alcodon;
25
26 /**
27  * Class AlcodonDescriptor.
28  * 
29  * @version $Revision$ $Date$
30  */
31 public class AlcodonDescriptor extends
32         org.exolab.castor.xml.util.XMLClassDescriptorImpl
33 {
34
35   // --------------------------/
36   // - Class/Member Variables -/
37   // --------------------------/
38
39   /**
40    * Field _elementDefinition.
41    */
42   private boolean _elementDefinition;
43
44   /**
45    * Field _nsPrefix.
46    */
47   private java.lang.String _nsPrefix;
48
49   /**
50    * Field _nsURI.
51    */
52   private java.lang.String _nsURI;
53
54   /**
55    * Field _xmlName.
56    */
57   private java.lang.String _xmlName;
58
59   // ----------------/
60   // - Constructors -/
61   // ----------------/
62
63   public AlcodonDescriptor()
64   {
65     super();
66     _nsURI = "www.vamsas.ac.uk/jalview/version2";
67     _xmlName = "alcodon";
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
73
74     // -- _pos1
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()
79     {
80       public java.lang.Object getValue(java.lang.Object object)
81               throws IllegalStateException
82       {
83         Alcodon target = (Alcodon) object;
84         if (!target.hasPos1())
85         {
86           return null;
87         }
88         return new java.lang.Long(target.getPos1());
89       }
90
91       public void setValue(java.lang.Object object, java.lang.Object value)
92               throws IllegalStateException, IllegalArgumentException
93       {
94         try
95         {
96           Alcodon target = (Alcodon) object;
97           // if null, use delete method for optional primitives
98           if (value == null)
99           {
100             target.deletePos1();
101             return;
102           }
103           target.setPos1(((java.lang.Long) value).longValue());
104         } catch (java.lang.Exception ex)
105         {
106           throw new IllegalStateException(ex.toString());
107         }
108       }
109
110       public java.lang.Object newInstance(java.lang.Object parent)
111       {
112         return null;
113       }
114     };
115     desc.setHandler(handler);
116     desc.setMultivalued(false);
117     addFieldDescriptor(desc);
118
119     // -- validation code for: _pos1
120     fieldValidator = new org.exolab.castor.xml.FieldValidator();
121     { // -- local scope
122       org.exolab.castor.xml.validators.LongValidator typeValidator;
123       typeValidator = new org.exolab.castor.xml.validators.LongValidator();
124       fieldValidator.setValidator(typeValidator);
125     }
126     desc.setValidator(fieldValidator);
127     // -- _pos2
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()
132     {
133       public java.lang.Object getValue(java.lang.Object object)
134               throws IllegalStateException
135       {
136         Alcodon target = (Alcodon) object;
137         if (!target.hasPos2())
138         {
139           return null;
140         }
141         return new java.lang.Long(target.getPos2());
142       }
143
144       public void setValue(java.lang.Object object, java.lang.Object value)
145               throws IllegalStateException, IllegalArgumentException
146       {
147         try
148         {
149           Alcodon target = (Alcodon) object;
150           // if null, use delete method for optional primitives
151           if (value == null)
152           {
153             target.deletePos2();
154             return;
155           }
156           target.setPos2(((java.lang.Long) value).longValue());
157         } catch (java.lang.Exception ex)
158         {
159           throw new IllegalStateException(ex.toString());
160         }
161       }
162
163       public java.lang.Object newInstance(java.lang.Object parent)
164       {
165         return null;
166       }
167     };
168     desc.setHandler(handler);
169     desc.setMultivalued(false);
170     addFieldDescriptor(desc);
171
172     // -- validation code for: _pos2
173     fieldValidator = new org.exolab.castor.xml.FieldValidator();
174     { // -- local scope
175       org.exolab.castor.xml.validators.LongValidator typeValidator;
176       typeValidator = new org.exolab.castor.xml.validators.LongValidator();
177       fieldValidator.setValidator(typeValidator);
178     }
179     desc.setValidator(fieldValidator);
180     // -- _pos3
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()
185     {
186       public java.lang.Object getValue(java.lang.Object object)
187               throws IllegalStateException
188       {
189         Alcodon target = (Alcodon) object;
190         if (!target.hasPos3())
191         {
192           return null;
193         }
194         return new java.lang.Long(target.getPos3());
195       }
196
197       public void setValue(java.lang.Object object, java.lang.Object value)
198               throws IllegalStateException, IllegalArgumentException
199       {
200         try
201         {
202           Alcodon target = (Alcodon) object;
203           // if null, use delete method for optional primitives
204           if (value == null)
205           {
206             target.deletePos3();
207             return;
208           }
209           target.setPos3(((java.lang.Long) value).longValue());
210         } catch (java.lang.Exception ex)
211         {
212           throw new IllegalStateException(ex.toString());
213         }
214       }
215
216       public java.lang.Object newInstance(java.lang.Object parent)
217       {
218         return null;
219       }
220     };
221     desc.setHandler(handler);
222     desc.setMultivalued(false);
223     addFieldDescriptor(desc);
224
225     // -- validation code for: _pos3
226     fieldValidator = new org.exolab.castor.xml.FieldValidator();
227     { // -- local scope
228       org.exolab.castor.xml.validators.LongValidator typeValidator;
229       typeValidator = new org.exolab.castor.xml.validators.LongValidator();
230       fieldValidator.setValidator(typeValidator);
231     }
232     desc.setValidator(fieldValidator);
233     // -- initialize element descriptors
234
235   }
236
237   // -----------/
238   // - Methods -/
239   // -----------/
240
241   /**
242    * Method getAccessMode.
243    * 
244    * @return the access mode specified for this class.
245    */
246   public org.exolab.castor.mapping.AccessMode getAccessMode()
247   {
248     return null;
249   }
250
251   /**
252    * Method getIdentity.
253    * 
254    * @return the identity field, null if this class has no identity.
255    */
256   public org.exolab.castor.mapping.FieldDescriptor getIdentity()
257   {
258     return super.getIdentity();
259   }
260
261   /**
262    * Method getJavaClass.
263    * 
264    * @return the Java class represented by this descriptor.
265    */
266   public java.lang.Class getJavaClass()
267   {
268     return jalview.schemabinding.version2.Alcodon.class;
269   }
270
271   /**
272    * Method getNameSpacePrefix.
273    * 
274    * @return the namespace prefix to use when marshaling as XML.
275    */
276   public java.lang.String getNameSpacePrefix()
277   {
278     return _nsPrefix;
279   }
280
281   /**
282    * Method getNameSpaceURI.
283    * 
284    * @return the namespace URI used when marshaling and unmarshaling as XML.
285    */
286   public java.lang.String getNameSpaceURI()
287   {
288     return _nsURI;
289   }
290
291   /**
292    * Method getValidator.
293    * 
294    * @return a specific validator for the class described by this
295    *         ClassDescriptor.
296    */
297   public org.exolab.castor.xml.TypeValidator getValidator()
298   {
299     return this;
300   }
301
302   /**
303    * Method getXMLName.
304    * 
305    * @return the XML Name for the Class being described.
306    */
307   public java.lang.String getXMLName()
308   {
309     return _xmlName;
310   }
311
312   /**
313    * Method isElementDefinition.
314    * 
315    * @return true if XML schema definition of this Class is that of a global
316    *         element or element with anonymous type definition.
317    */
318   public boolean isElementDefinition()
319   {
320     return _elementDefinition;
321   }
322
323 }