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