d32bc03e4b1cc5d6c7904159a0e10d869daf95bb
[jalview.git] / src / jalview / schemabinding / version2 / descriptors / MapListToDescriptor.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.MapListTo;
25
26 /**
27  * Class MapListToDescriptor.
28  * 
29  * @version $Revision$ $Date$
30  */
31 public class MapListToDescriptor 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 MapListToDescriptor()
64   {
65     super();
66     _nsURI = "www.vamsas.ac.uk/jalview/version2";
67     _xmlName = "mapListTo";
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     // -- _start
75     desc = new org.exolab.castor.xml.util.XMLFieldDescriptorImpl(
76             java.lang.Integer.TYPE, "_start", "start",
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         MapListTo target = (MapListTo) object;
84         if (!target.hasStart())
85         {
86           return null;
87         }
88         return new java.lang.Integer(target.getStart());
89       }
90
91       public void setValue(java.lang.Object object, java.lang.Object value)
92               throws IllegalStateException, IllegalArgumentException
93       {
94         try
95         {
96           MapListTo target = (MapListTo) object;
97           // ignore null values for non optional primitives
98           if (value == null)
99           {
100             return;
101           }
102
103           target.setStart(((java.lang.Integer) value).intValue());
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.setRequired(true);
117     desc.setMultivalued(false);
118     addFieldDescriptor(desc);
119
120     // -- validation code for: _start
121     fieldValidator = new org.exolab.castor.xml.FieldValidator();
122     fieldValidator.setMinOccurs(1);
123     { // -- local scope
124       org.exolab.castor.xml.validators.IntValidator typeValidator;
125       typeValidator = new org.exolab.castor.xml.validators.IntValidator();
126       fieldValidator.setValidator(typeValidator);
127       typeValidator.setMinInclusive(-2147483648);
128       typeValidator.setMaxInclusive(2147483647);
129     }
130     desc.setValidator(fieldValidator);
131     // -- _end
132     desc = new org.exolab.castor.xml.util.XMLFieldDescriptorImpl(
133             java.lang.Integer.TYPE, "_end", "end",
134             org.exolab.castor.xml.NodeType.Attribute);
135     handler = new org.exolab.castor.xml.XMLFieldHandler()
136     {
137       public java.lang.Object getValue(java.lang.Object object)
138               throws IllegalStateException
139       {
140         MapListTo target = (MapListTo) object;
141         if (!target.hasEnd())
142         {
143           return null;
144         }
145         return new java.lang.Integer(target.getEnd());
146       }
147
148       public void setValue(java.lang.Object object, java.lang.Object value)
149               throws IllegalStateException, IllegalArgumentException
150       {
151         try
152         {
153           MapListTo target = (MapListTo) object;
154           // ignore null values for non optional primitives
155           if (value == null)
156           {
157             return;
158           }
159
160           target.setEnd(((java.lang.Integer) value).intValue());
161         } catch (java.lang.Exception ex)
162         {
163           throw new IllegalStateException(ex.toString());
164         }
165       }
166
167       public java.lang.Object newInstance(java.lang.Object parent)
168       {
169         return null;
170       }
171     };
172     desc.setHandler(handler);
173     desc.setRequired(true);
174     desc.setMultivalued(false);
175     addFieldDescriptor(desc);
176
177     // -- validation code for: _end
178     fieldValidator = new org.exolab.castor.xml.FieldValidator();
179     fieldValidator.setMinOccurs(1);
180     { // -- local scope
181       org.exolab.castor.xml.validators.IntValidator typeValidator;
182       typeValidator = new org.exolab.castor.xml.validators.IntValidator();
183       fieldValidator.setValidator(typeValidator);
184       typeValidator.setMinInclusive(-2147483648);
185       typeValidator.setMaxInclusive(2147483647);
186     }
187     desc.setValidator(fieldValidator);
188     // -- initialize element descriptors
189
190   }
191
192   // -----------/
193   // - Methods -/
194   // -----------/
195
196   /**
197    * Method getAccessMode.
198    * 
199    * @return the access mode specified for this class.
200    */
201   public org.exolab.castor.mapping.AccessMode getAccessMode()
202   {
203     return null;
204   }
205
206   /**
207    * Method getIdentity.
208    * 
209    * @return the identity field, null if this class has no identity.
210    */
211   public org.exolab.castor.mapping.FieldDescriptor getIdentity()
212   {
213     return super.getIdentity();
214   }
215
216   /**
217    * Method getJavaClass.
218    * 
219    * @return the Java class represented by this descriptor.
220    */
221   public java.lang.Class getJavaClass()
222   {
223     return jalview.schemabinding.version2.MapListTo.class;
224   }
225
226   /**
227    * Method getNameSpacePrefix.
228    * 
229    * @return the namespace prefix to use when marshaling as XML.
230    */
231   public java.lang.String getNameSpacePrefix()
232   {
233     return _nsPrefix;
234   }
235
236   /**
237    * Method getNameSpaceURI.
238    * 
239    * @return the namespace URI used when marshaling and unmarshaling as XML.
240    */
241   public java.lang.String getNameSpaceURI()
242   {
243     return _nsURI;
244   }
245
246   /**
247    * Method getValidator.
248    * 
249    * @return a specific validator for the class described by this
250    *         ClassDescriptor.
251    */
252   public org.exolab.castor.xml.TypeValidator getValidator()
253   {
254     return this;
255   }
256
257   /**
258    * Method getXMLName.
259    * 
260    * @return the XML Name for the Class being described.
261    */
262   public java.lang.String getXMLName()
263   {
264     return _xmlName;
265   }
266
267   /**
268    * Method isElementDefinition.
269    * 
270    * @return true if XML schema definition of this Class is that of a global
271    *         element or element with anonymous type definition.
272    */
273   public boolean isElementDefinition()
274   {
275     return _elementDefinition;
276   }
277
278 }