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