JAL-1432 updated copyright notices
[jalview.git] / src / jalview / schemabinding / version2 / descriptors / SequenceTypeDescriptor.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.SequenceType;
26
27 /**
28  * Class SequenceTypeDescriptor.
29  * 
30  * @version $Revision$ $Date$
31  */
32 public class SequenceTypeDescriptor 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 SequenceTypeDescriptor()
65   {
66     super();
67     _nsURI = "www.vamsas.ac.uk/jalview/version2";
68     _xmlName = "SequenceType";
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     // -- _id
79     desc = new org.exolab.castor.xml.util.XMLFieldDescriptorImpl(
80             java.lang.String.class, "_id", "id",
81             org.exolab.castor.xml.NodeType.Attribute);
82     desc.setImmutable(true);
83     handler = new org.exolab.castor.xml.XMLFieldHandler()
84     {
85       public java.lang.Object getValue(java.lang.Object object)
86               throws IllegalStateException
87       {
88         SequenceType target = (SequenceType) object;
89         return target.getId();
90       }
91
92       public void setValue(java.lang.Object object, java.lang.Object value)
93               throws IllegalStateException, IllegalArgumentException
94       {
95         try
96         {
97           SequenceType target = (SequenceType) object;
98           target.setId((java.lang.String) value);
99         } catch (java.lang.Exception ex)
100         {
101           throw new IllegalStateException(ex.toString());
102         }
103       }
104
105       public java.lang.Object newInstance(java.lang.Object parent)
106       {
107         return null;
108       }
109     };
110     desc.setHandler(handler);
111     desc.setMultivalued(false);
112     addFieldDescriptor(desc);
113
114     // -- validation code for: _id
115     fieldValidator = new org.exolab.castor.xml.FieldValidator();
116     { // -- local scope
117       org.exolab.castor.xml.validators.StringValidator typeValidator;
118       typeValidator = new org.exolab.castor.xml.validators.StringValidator();
119       fieldValidator.setValidator(typeValidator);
120       typeValidator.setWhiteSpace("preserve");
121     }
122     desc.setValidator(fieldValidator);
123     // -- _description
124     desc = new org.exolab.castor.xml.util.XMLFieldDescriptorImpl(
125             java.lang.String.class, "_description", "description",
126             org.exolab.castor.xml.NodeType.Attribute);
127     desc.setImmutable(true);
128     handler = new org.exolab.castor.xml.XMLFieldHandler()
129     {
130       public java.lang.Object getValue(java.lang.Object object)
131               throws IllegalStateException
132       {
133         SequenceType target = (SequenceType) object;
134         return target.getDescription();
135       }
136
137       public void setValue(java.lang.Object object, java.lang.Object value)
138               throws IllegalStateException, IllegalArgumentException
139       {
140         try
141         {
142           SequenceType target = (SequenceType) object;
143           target.setDescription((java.lang.String) value);
144         } catch (java.lang.Exception ex)
145         {
146           throw new IllegalStateException(ex.toString());
147         }
148       }
149
150       public java.lang.Object newInstance(java.lang.Object parent)
151       {
152         return null;
153       }
154     };
155     desc.setHandler(handler);
156     desc.setMultivalued(false);
157     addFieldDescriptor(desc);
158
159     // -- validation code for: _description
160     fieldValidator = new org.exolab.castor.xml.FieldValidator();
161     { // -- local scope
162       org.exolab.castor.xml.validators.StringValidator typeValidator;
163       typeValidator = new org.exolab.castor.xml.validators.StringValidator();
164       fieldValidator.setValidator(typeValidator);
165       typeValidator.setWhiteSpace("preserve");
166     }
167     desc.setValidator(fieldValidator);
168     // -- initialize element descriptors
169
170     // -- _sequence
171     desc = new org.exolab.castor.xml.util.XMLFieldDescriptorImpl(
172             java.lang.String.class, "_sequence", "sequence",
173             org.exolab.castor.xml.NodeType.Element);
174     desc.setImmutable(true);
175     handler = new org.exolab.castor.xml.XMLFieldHandler()
176     {
177       public java.lang.Object getValue(java.lang.Object object)
178               throws IllegalStateException
179       {
180         SequenceType target = (SequenceType) object;
181         return target.getSequence();
182       }
183
184       public void setValue(java.lang.Object object, java.lang.Object value)
185               throws IllegalStateException, IllegalArgumentException
186       {
187         try
188         {
189           SequenceType target = (SequenceType) object;
190           target.setSequence((java.lang.String) value);
191         } catch (java.lang.Exception ex)
192         {
193           throw new IllegalStateException(ex.toString());
194         }
195       }
196
197       public java.lang.Object newInstance(java.lang.Object parent)
198       {
199         return null;
200       }
201     };
202     desc.setHandler(handler);
203     desc.setNameSpaceURI("www.vamsas.ac.uk/jalview/version2");
204     desc.setMultivalued(false);
205     addFieldDescriptor(desc);
206
207     // -- validation code for: _sequence
208     fieldValidator = new org.exolab.castor.xml.FieldValidator();
209     { // -- local scope
210       org.exolab.castor.xml.validators.StringValidator typeValidator;
211       typeValidator = new org.exolab.castor.xml.validators.StringValidator();
212       fieldValidator.setValidator(typeValidator);
213       typeValidator.setWhiteSpace("preserve");
214     }
215     desc.setValidator(fieldValidator);
216     // -- _name
217     desc = new org.exolab.castor.xml.util.XMLFieldDescriptorImpl(
218             java.lang.String.class, "_name", "name",
219             org.exolab.castor.xml.NodeType.Element);
220     desc.setImmutable(true);
221     handler = new org.exolab.castor.xml.XMLFieldHandler()
222     {
223       public java.lang.Object getValue(java.lang.Object object)
224               throws IllegalStateException
225       {
226         SequenceType target = (SequenceType) object;
227         return target.getName();
228       }
229
230       public void setValue(java.lang.Object object, java.lang.Object value)
231               throws IllegalStateException, IllegalArgumentException
232       {
233         try
234         {
235           SequenceType target = (SequenceType) object;
236           target.setName((java.lang.String) value);
237         } catch (java.lang.Exception ex)
238         {
239           throw new IllegalStateException(ex.toString());
240         }
241       }
242
243       public java.lang.Object newInstance(java.lang.Object parent)
244       {
245         return null;
246       }
247     };
248     desc.setHandler(handler);
249     desc.setNameSpaceURI("www.vamsas.ac.uk/jalview/version2");
250     desc.setMultivalued(false);
251     addFieldDescriptor(desc);
252
253     // -- validation code for: _name
254     fieldValidator = new org.exolab.castor.xml.FieldValidator();
255     { // -- local scope
256       org.exolab.castor.xml.validators.StringValidator typeValidator;
257       typeValidator = new org.exolab.castor.xml.validators.StringValidator();
258       fieldValidator.setValidator(typeValidator);
259       typeValidator.setWhiteSpace("preserve");
260     }
261     desc.setValidator(fieldValidator);
262   }
263
264   // -----------/
265   // - Methods -/
266   // -----------/
267
268   /**
269    * Method getAccessMode.
270    * 
271    * @return the access mode specified for this class.
272    */
273   public org.exolab.castor.mapping.AccessMode getAccessMode()
274   {
275     return null;
276   }
277
278   /**
279    * Method getIdentity.
280    * 
281    * @return the identity field, null if this class has no identity.
282    */
283   public org.exolab.castor.mapping.FieldDescriptor getIdentity()
284   {
285     return super.getIdentity();
286   }
287
288   /**
289    * Method getJavaClass.
290    * 
291    * @return the Java class represented by this descriptor.
292    */
293   public java.lang.Class getJavaClass()
294   {
295     return jalview.schemabinding.version2.SequenceType.class;
296   }
297
298   /**
299    * Method getNameSpacePrefix.
300    * 
301    * @return the namespace prefix to use when marshaling as XML.
302    */
303   public java.lang.String getNameSpacePrefix()
304   {
305     return _nsPrefix;
306   }
307
308   /**
309    * Method getNameSpaceURI.
310    * 
311    * @return the namespace URI used when marshaling and unmarshaling as XML.
312    */
313   public java.lang.String getNameSpaceURI()
314   {
315     return _nsURI;
316   }
317
318   /**
319    * Method getValidator.
320    * 
321    * @return a specific validator for the class described by this
322    *         ClassDescriptor.
323    */
324   public org.exolab.castor.xml.TypeValidator getValidator()
325   {
326     return this;
327   }
328
329   /**
330    * Method getXMLName.
331    * 
332    * @return the XML Name for the Class being described.
333    */
334   public java.lang.String getXMLName()
335   {
336     return _xmlName;
337   }
338
339   /**
340    * Method isElementDefinition.
341    * 
342    * @return true if XML schema definition of this Class is that of a global
343    *         element or element with anonymous type definition.
344    */
345   public boolean isElementDefinition()
346   {
347     return _elementDefinition;
348   }
349
350 }