JAL-1432 updated copyright notices
[jalview.git] / src / jalview / schemabinding / version2 / descriptors / SequenceDescriptor.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.Sequence;
26
27 /**
28  * Class SequenceDescriptor.
29  * 
30  * @version $Revision$ $Date$
31  */
32 public class SequenceDescriptor extends
33         jalview.schemabinding.version2.descriptors.SequenceTypeDescriptor
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 SequenceDescriptor()
65   {
66     super();
67     setExtendsWithoutFlatten(new jalview.schemabinding.version2.descriptors.SequenceTypeDescriptor());
68     _nsURI = "www.vamsas.ac.uk/jalview/version2";
69     _xmlName = "Sequence";
70     _elementDefinition = true;
71
72     // -- set grouping compositor
73     setCompositorAsSequence();
74     org.exolab.castor.xml.util.XMLFieldDescriptorImpl desc = null;
75     org.exolab.castor.mapping.FieldHandler handler = null;
76     org.exolab.castor.xml.FieldValidator fieldValidator = null;
77     // -- initialize attribute descriptors
78
79     // -- _dsseqid
80     desc = new org.exolab.castor.xml.util.XMLFieldDescriptorImpl(
81             java.lang.String.class, "_dsseqid", "dsseqid",
82             org.exolab.castor.xml.NodeType.Attribute);
83     desc.setImmutable(true);
84     handler = new org.exolab.castor.xml.XMLFieldHandler()
85     {
86       public java.lang.Object getValue(java.lang.Object object)
87               throws IllegalStateException
88       {
89         Sequence target = (Sequence) object;
90         return target.getDsseqid();
91       }
92
93       public void setValue(java.lang.Object object, java.lang.Object value)
94               throws IllegalStateException, IllegalArgumentException
95       {
96         try
97         {
98           Sequence target = (Sequence) object;
99           target.setDsseqid((java.lang.String) value);
100         } catch (java.lang.Exception ex)
101         {
102           throw new IllegalStateException(ex.toString());
103         }
104       }
105
106       public java.lang.Object newInstance(java.lang.Object parent)
107       {
108         return null;
109       }
110     };
111     desc.setHandler(handler);
112     desc.setMultivalued(false);
113     addFieldDescriptor(desc);
114
115     // -- validation code for: _dsseqid
116     fieldValidator = new org.exolab.castor.xml.FieldValidator();
117     { // -- local scope
118       org.exolab.castor.xml.validators.StringValidator typeValidator;
119       typeValidator = new org.exolab.castor.xml.validators.StringValidator();
120       fieldValidator.setValidator(typeValidator);
121       typeValidator.setWhiteSpace("preserve");
122     }
123     desc.setValidator(fieldValidator);
124     // -- initialize element descriptors
125
126     // -- _DBRefList
127     desc = new org.exolab.castor.xml.util.XMLFieldDescriptorImpl(
128             jalview.schemabinding.version2.DBRef.class, "_DBRefList",
129             "DBRef", org.exolab.castor.xml.NodeType.Element);
130     handler = new org.exolab.castor.xml.XMLFieldHandler()
131     {
132       public java.lang.Object getValue(java.lang.Object object)
133               throws IllegalStateException
134       {
135         Sequence target = (Sequence) object;
136         return target.getDBRef();
137       }
138
139       public void setValue(java.lang.Object object, java.lang.Object value)
140               throws IllegalStateException, IllegalArgumentException
141       {
142         try
143         {
144           Sequence target = (Sequence) object;
145           target.addDBRef((jalview.schemabinding.version2.DBRef) value);
146         } catch (java.lang.Exception ex)
147         {
148           throw new IllegalStateException(ex.toString());
149         }
150       }
151
152       public void resetValue(Object object) throws IllegalStateException,
153               IllegalArgumentException
154       {
155         try
156         {
157           Sequence target = (Sequence) object;
158           target.removeAllDBRef();
159         } catch (java.lang.Exception ex)
160         {
161           throw new IllegalStateException(ex.toString());
162         }
163       }
164
165       public java.lang.Object newInstance(java.lang.Object parent)
166       {
167         return new jalview.schemabinding.version2.DBRef();
168       }
169     };
170     desc.setHandler(handler);
171     desc.setNameSpaceURI("www.vamsas.ac.uk/jalview/version2");
172     desc.setMultivalued(true);
173     addFieldDescriptor(desc);
174
175     // -- validation code for: _DBRefList
176     fieldValidator = new org.exolab.castor.xml.FieldValidator();
177     fieldValidator.setMinOccurs(0);
178     { // -- local scope
179     }
180     desc.setValidator(fieldValidator);
181   }
182
183   // -----------/
184   // - Methods -/
185   // -----------/
186
187   /**
188    * Method getAccessMode.
189    * 
190    * @return the access mode specified for this class.
191    */
192   public org.exolab.castor.mapping.AccessMode getAccessMode()
193   {
194     return null;
195   }
196
197   /**
198    * Method getIdentity.
199    * 
200    * @return the identity field, null if this class has no identity.
201    */
202   public org.exolab.castor.mapping.FieldDescriptor getIdentity()
203   {
204     return super.getIdentity();
205   }
206
207   /**
208    * Method getJavaClass.
209    * 
210    * @return the Java class represented by this descriptor.
211    */
212   public java.lang.Class getJavaClass()
213   {
214     return jalview.schemabinding.version2.Sequence.class;
215   }
216
217   /**
218    * Method getNameSpacePrefix.
219    * 
220    * @return the namespace prefix to use when marshaling as XML.
221    */
222   public java.lang.String getNameSpacePrefix()
223   {
224     return _nsPrefix;
225   }
226
227   /**
228    * Method getNameSpaceURI.
229    * 
230    * @return the namespace URI used when marshaling and unmarshaling as XML.
231    */
232   public java.lang.String getNameSpaceURI()
233   {
234     return _nsURI;
235   }
236
237   /**
238    * Method getValidator.
239    * 
240    * @return a specific validator for the class described by this
241    *         ClassDescriptor.
242    */
243   public org.exolab.castor.xml.TypeValidator getValidator()
244   {
245     return this;
246   }
247
248   /**
249    * Method getXMLName.
250    * 
251    * @return the XML Name for the Class being described.
252    */
253   public java.lang.String getXMLName()
254   {
255     return _xmlName;
256   }
257
258   /**
259    * Method isElementDefinition.
260    * 
261    * @return true if XML schema definition of this Class is that of a global
262    *         element or element with anonymous type definition.
263    */
264   public boolean isElementDefinition()
265   {
266     return _elementDefinition;
267   }
268
269 }