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