JAL-1432 updated copyright notices
[jalview.git] / src / jalview / schemabinding / version2 / descriptors / DBRefDescriptor.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.DBRef;
26
27 /**
28  * Class DBRefDescriptor.
29  * 
30  * @version $Revision$ $Date$
31  */
32 public class DBRefDescriptor 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 DBRefDescriptor()
65   {
66     super();
67     _nsURI = "www.vamsas.ac.uk/jalview/version2";
68     _xmlName = "DBRef";
69     _elementDefinition = true;
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     // -- _source
79     desc = new org.exolab.castor.xml.util.XMLFieldDescriptorImpl(
80             java.lang.String.class, "_source", "source",
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         DBRef target = (DBRef) object;
89         return target.getSource();
90       }
91
92       public void setValue(java.lang.Object object, java.lang.Object value)
93               throws IllegalStateException, IllegalArgumentException
94       {
95         try
96         {
97           DBRef target = (DBRef) object;
98           target.setSource((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: _source
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     // -- _version
124     desc = new org.exolab.castor.xml.util.XMLFieldDescriptorImpl(
125             java.lang.String.class, "_version", "version",
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         DBRef target = (DBRef) object;
134         return target.getVersion();
135       }
136
137       public void setValue(java.lang.Object object, java.lang.Object value)
138               throws IllegalStateException, IllegalArgumentException
139       {
140         try
141         {
142           DBRef target = (DBRef) object;
143           target.setVersion((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: _version
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     // -- _accessionId
169     desc = new org.exolab.castor.xml.util.XMLFieldDescriptorImpl(
170             java.lang.String.class, "_accessionId", "accessionId",
171             org.exolab.castor.xml.NodeType.Attribute);
172     desc.setImmutable(true);
173     handler = new org.exolab.castor.xml.XMLFieldHandler()
174     {
175       public java.lang.Object getValue(java.lang.Object object)
176               throws IllegalStateException
177       {
178         DBRef target = (DBRef) object;
179         return target.getAccessionId();
180       }
181
182       public void setValue(java.lang.Object object, java.lang.Object value)
183               throws IllegalStateException, IllegalArgumentException
184       {
185         try
186         {
187           DBRef target = (DBRef) object;
188           target.setAccessionId((java.lang.String) value);
189         } catch (java.lang.Exception ex)
190         {
191           throw new IllegalStateException(ex.toString());
192         }
193       }
194
195       public java.lang.Object newInstance(java.lang.Object parent)
196       {
197         return null;
198       }
199     };
200     desc.setHandler(handler);
201     desc.setMultivalued(false);
202     addFieldDescriptor(desc);
203
204     // -- validation code for: _accessionId
205     fieldValidator = new org.exolab.castor.xml.FieldValidator();
206     { // -- local scope
207       org.exolab.castor.xml.validators.StringValidator typeValidator;
208       typeValidator = new org.exolab.castor.xml.validators.StringValidator();
209       fieldValidator.setValidator(typeValidator);
210       typeValidator.setWhiteSpace("preserve");
211     }
212     desc.setValidator(fieldValidator);
213     // -- initialize element descriptors
214
215     // -- _mapping
216     desc = new org.exolab.castor.xml.util.XMLFieldDescriptorImpl(
217             jalview.schemabinding.version2.Mapping.class, "_mapping",
218             "Mapping", org.exolab.castor.xml.NodeType.Element);
219     handler = new org.exolab.castor.xml.XMLFieldHandler()
220     {
221       public java.lang.Object getValue(java.lang.Object object)
222               throws IllegalStateException
223       {
224         DBRef target = (DBRef) object;
225         return target.getMapping();
226       }
227
228       public void setValue(java.lang.Object object, java.lang.Object value)
229               throws IllegalStateException, IllegalArgumentException
230       {
231         try
232         {
233           DBRef target = (DBRef) object;
234           target.setMapping((jalview.schemabinding.version2.Mapping) value);
235         } catch (java.lang.Exception ex)
236         {
237           throw new IllegalStateException(ex.toString());
238         }
239       }
240
241       public java.lang.Object newInstance(java.lang.Object parent)
242       {
243         return new jalview.schemabinding.version2.Mapping();
244       }
245     };
246     desc.setHandler(handler);
247     desc.setNameSpaceURI("www.vamsas.ac.uk/jalview/version2");
248     desc.setMultivalued(false);
249     addFieldDescriptor(desc);
250
251     // -- validation code for: _mapping
252     fieldValidator = new org.exolab.castor.xml.FieldValidator();
253     { // -- local scope
254     }
255     desc.setValidator(fieldValidator);
256   }
257
258   // -----------/
259   // - Methods -/
260   // -----------/
261
262   /**
263    * Method getAccessMode.
264    * 
265    * @return the access mode specified for this class.
266    */
267   public org.exolab.castor.mapping.AccessMode getAccessMode()
268   {
269     return null;
270   }
271
272   /**
273    * Method getIdentity.
274    * 
275    * @return the identity field, null if this class has no identity.
276    */
277   public org.exolab.castor.mapping.FieldDescriptor getIdentity()
278   {
279     return super.getIdentity();
280   }
281
282   /**
283    * Method getJavaClass.
284    * 
285    * @return the Java class represented by this descriptor.
286    */
287   public java.lang.Class getJavaClass()
288   {
289     return jalview.schemabinding.version2.DBRef.class;
290   }
291
292   /**
293    * Method getNameSpacePrefix.
294    * 
295    * @return the namespace prefix to use when marshaling as XML.
296    */
297   public java.lang.String getNameSpacePrefix()
298   {
299     return _nsPrefix;
300   }
301
302   /**
303    * Method getNameSpaceURI.
304    * 
305    * @return the namespace URI used when marshaling and unmarshaling as XML.
306    */
307   public java.lang.String getNameSpaceURI()
308   {
309     return _nsURI;
310   }
311
312   /**
313    * Method getValidator.
314    * 
315    * @return a specific validator for the class described by this
316    *         ClassDescriptor.
317    */
318   public org.exolab.castor.xml.TypeValidator getValidator()
319   {
320     return this;
321   }
322
323   /**
324    * Method getXMLName.
325    * 
326    * @return the XML Name for the Class being described.
327    */
328   public java.lang.String getXMLName()
329   {
330     return _xmlName;
331   }
332
333   /**
334    * Method isElementDefinition.
335    * 
336    * @return true if XML schema definition of this Class is that of a global
337    *         element or element with anonymous type definition.
338    */
339   public boolean isElementDefinition()
340   {
341     return _elementDefinition;
342   }
343
344 }