7f3c72e55461cac84cf63c4349be349812a7eb65
[jalview.git] / src / jalview / schemabinding / version2 / descriptors / MapListTypeDescriptor.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.MapListType;
25
26 /**
27  * Class MapListTypeDescriptor.
28  * 
29  * @version $Revision$ $Date$
30  */
31 public class MapListTypeDescriptor 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 MapListTypeDescriptor()
64   {
65     super();
66     _nsURI = "www.vamsas.ac.uk/jalview/version2";
67     _xmlName = "mapListType";
68     _elementDefinition = false;
69
70     // -- set grouping compositor
71     setCompositorAsSequence();
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     // -- _mapFromUnit
78     desc = new org.exolab.castor.xml.util.XMLFieldDescriptorImpl(
79             java.lang.Long.TYPE, "_mapFromUnit", "mapFromUnit",
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         MapListType target = (MapListType) object;
87         if (!target.hasMapFromUnit())
88         {
89           return null;
90         }
91         return new java.lang.Long(target.getMapFromUnit());
92       }
93
94       public void setValue(java.lang.Object object, java.lang.Object value)
95               throws IllegalStateException, IllegalArgumentException
96       {
97         try
98         {
99           MapListType target = (MapListType) object;
100           // ignore null values for non optional primitives
101           if (value == null)
102           {
103             return;
104           }
105
106           target.setMapFromUnit(((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.setRequired(true);
120     desc.setMultivalued(false);
121     addFieldDescriptor(desc);
122
123     // -- validation code for: _mapFromUnit
124     fieldValidator = new org.exolab.castor.xml.FieldValidator();
125     fieldValidator.setMinOccurs(1);
126     { // -- local scope
127       org.exolab.castor.xml.validators.LongValidator typeValidator;
128       typeValidator = new org.exolab.castor.xml.validators.LongValidator();
129       fieldValidator.setValidator(typeValidator);
130       typeValidator.setMinInclusive(1L);
131     }
132     desc.setValidator(fieldValidator);
133     // -- _mapToUnit
134     desc = new org.exolab.castor.xml.util.XMLFieldDescriptorImpl(
135             java.lang.Long.TYPE, "_mapToUnit", "mapToUnit",
136             org.exolab.castor.xml.NodeType.Attribute);
137     handler = new org.exolab.castor.xml.XMLFieldHandler()
138     {
139       public java.lang.Object getValue(java.lang.Object object)
140               throws IllegalStateException
141       {
142         MapListType target = (MapListType) object;
143         if (!target.hasMapToUnit())
144         {
145           return null;
146         }
147         return new java.lang.Long(target.getMapToUnit());
148       }
149
150       public void setValue(java.lang.Object object, java.lang.Object value)
151               throws IllegalStateException, IllegalArgumentException
152       {
153         try
154         {
155           MapListType target = (MapListType) object;
156           // ignore null values for non optional primitives
157           if (value == null)
158           {
159             return;
160           }
161
162           target.setMapToUnit(((java.lang.Long) value).longValue());
163         } catch (java.lang.Exception ex)
164         {
165           throw new IllegalStateException(ex.toString());
166         }
167       }
168
169       public java.lang.Object newInstance(java.lang.Object parent)
170       {
171         return null;
172       }
173     };
174     desc.setHandler(handler);
175     desc.setRequired(true);
176     desc.setMultivalued(false);
177     addFieldDescriptor(desc);
178
179     // -- validation code for: _mapToUnit
180     fieldValidator = new org.exolab.castor.xml.FieldValidator();
181     fieldValidator.setMinOccurs(1);
182     { // -- local scope
183       org.exolab.castor.xml.validators.LongValidator typeValidator;
184       typeValidator = new org.exolab.castor.xml.validators.LongValidator();
185       fieldValidator.setValidator(typeValidator);
186       typeValidator.setMinInclusive(1L);
187     }
188     desc.setValidator(fieldValidator);
189     // -- initialize element descriptors
190
191     // -- _mapListFromList
192     desc = new org.exolab.castor.xml.util.XMLFieldDescriptorImpl(
193             jalview.schemabinding.version2.MapListFrom.class,
194             "_mapListFromList", "mapListFrom",
195             org.exolab.castor.xml.NodeType.Element);
196     handler = new org.exolab.castor.xml.XMLFieldHandler()
197     {
198       public java.lang.Object getValue(java.lang.Object object)
199               throws IllegalStateException
200       {
201         MapListType target = (MapListType) object;
202         return target.getMapListFrom();
203       }
204
205       public void setValue(java.lang.Object object, java.lang.Object value)
206               throws IllegalStateException, IllegalArgumentException
207       {
208         try
209         {
210           MapListType target = (MapListType) object;
211           target.addMapListFrom((jalview.schemabinding.version2.MapListFrom) value);
212         } catch (java.lang.Exception ex)
213         {
214           throw new IllegalStateException(ex.toString());
215         }
216       }
217
218       public void resetValue(Object object) throws IllegalStateException,
219               IllegalArgumentException
220       {
221         try
222         {
223           MapListType target = (MapListType) object;
224           target.removeAllMapListFrom();
225         } catch (java.lang.Exception ex)
226         {
227           throw new IllegalStateException(ex.toString());
228         }
229       }
230
231       public java.lang.Object newInstance(java.lang.Object parent)
232       {
233         return new jalview.schemabinding.version2.MapListFrom();
234       }
235     };
236     desc.setHandler(handler);
237     desc.setNameSpaceURI("www.vamsas.ac.uk/jalview/version2");
238     desc.setMultivalued(true);
239     addFieldDescriptor(desc);
240
241     // -- validation code for: _mapListFromList
242     fieldValidator = new org.exolab.castor.xml.FieldValidator();
243     fieldValidator.setMinOccurs(0);
244     { // -- local scope
245     }
246     desc.setValidator(fieldValidator);
247     // -- _mapListToList
248     desc = new org.exolab.castor.xml.util.XMLFieldDescriptorImpl(
249             jalview.schemabinding.version2.MapListTo.class,
250             "_mapListToList", "mapListTo",
251             org.exolab.castor.xml.NodeType.Element);
252     handler = new org.exolab.castor.xml.XMLFieldHandler()
253     {
254       public java.lang.Object getValue(java.lang.Object object)
255               throws IllegalStateException
256       {
257         MapListType target = (MapListType) object;
258         return target.getMapListTo();
259       }
260
261       public void setValue(java.lang.Object object, java.lang.Object value)
262               throws IllegalStateException, IllegalArgumentException
263       {
264         try
265         {
266           MapListType target = (MapListType) object;
267           target.addMapListTo((jalview.schemabinding.version2.MapListTo) value);
268         } catch (java.lang.Exception ex)
269         {
270           throw new IllegalStateException(ex.toString());
271         }
272       }
273
274       public void resetValue(Object object) throws IllegalStateException,
275               IllegalArgumentException
276       {
277         try
278         {
279           MapListType target = (MapListType) object;
280           target.removeAllMapListTo();
281         } catch (java.lang.Exception ex)
282         {
283           throw new IllegalStateException(ex.toString());
284         }
285       }
286
287       public java.lang.Object newInstance(java.lang.Object parent)
288       {
289         return new jalview.schemabinding.version2.MapListTo();
290       }
291     };
292     desc.setHandler(handler);
293     desc.setNameSpaceURI("www.vamsas.ac.uk/jalview/version2");
294     desc.setMultivalued(true);
295     addFieldDescriptor(desc);
296
297     // -- validation code for: _mapListToList
298     fieldValidator = new org.exolab.castor.xml.FieldValidator();
299     fieldValidator.setMinOccurs(0);
300     { // -- local scope
301     }
302     desc.setValidator(fieldValidator);
303   }
304
305   // -----------/
306   // - Methods -/
307   // -----------/
308
309   /**
310    * Method getAccessMode.
311    * 
312    * @return the access mode specified for this class.
313    */
314   public org.exolab.castor.mapping.AccessMode getAccessMode()
315   {
316     return null;
317   }
318
319   /**
320    * Method getIdentity.
321    * 
322    * @return the identity field, null if this class has no identity.
323    */
324   public org.exolab.castor.mapping.FieldDescriptor getIdentity()
325   {
326     return super.getIdentity();
327   }
328
329   /**
330    * Method getJavaClass.
331    * 
332    * @return the Java class represented by this descriptor.
333    */
334   public java.lang.Class getJavaClass()
335   {
336     return jalview.schemabinding.version2.MapListType.class;
337   }
338
339   /**
340    * Method getNameSpacePrefix.
341    * 
342    * @return the namespace prefix to use when marshaling as XML.
343    */
344   public java.lang.String getNameSpacePrefix()
345   {
346     return _nsPrefix;
347   }
348
349   /**
350    * Method getNameSpaceURI.
351    * 
352    * @return the namespace URI used when marshaling and unmarshaling as XML.
353    */
354   public java.lang.String getNameSpaceURI()
355   {
356     return _nsURI;
357   }
358
359   /**
360    * Method getValidator.
361    * 
362    * @return a specific validator for the class described by this
363    *         ClassDescriptor.
364    */
365   public org.exolab.castor.xml.TypeValidator getValidator()
366   {
367     return this;
368   }
369
370   /**
371    * Method getXMLName.
372    * 
373    * @return the XML Name for the Class being described.
374    */
375   public java.lang.String getXMLName()
376   {
377     return _xmlName;
378   }
379
380   /**
381    * Method isElementDefinition.
382    * 
383    * @return true if XML schema definition of this Class is that of a global
384    *         element or element with anonymous type definition.
385    */
386   public boolean isElementDefinition()
387   {
388     return _elementDefinition;
389   }
390
391 }