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