1 /*******************************************************************************
2 * Jalview - A Sequence Alignment Editor and Viewer (Version 2.7)
3 * Copyright (C) 2011 J Procter, AM Waterhouse, G Barton, M Clamp, S Searle
5 * This file is part of Jalview.
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.
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.
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 *******************************************************************************/
19 * This class was automatically generated with
20 * <a href="http://www.castor.org">Castor 1.1</a>, using an XML
25 package jalview.schemabinding.version2.descriptors;
27 //---------------------------------/
28 //- Imported classes and packages -/
29 //---------------------------------/
31 import jalview.schemabinding.version2.DBRef;
34 * Class DBRefDescriptor.
36 * @version $Revision$ $Date$
38 public class DBRefDescriptor extends org.exolab.castor.xml.util.XMLClassDescriptorImpl {
41 //--------------------------/
42 //- Class/Member Variables -/
43 //--------------------------/
46 * Field _elementDefinition.
48 private boolean _elementDefinition;
53 private java.lang.String _nsPrefix;
58 private java.lang.String _nsURI;
63 private java.lang.String _xmlName;
70 public DBRefDescriptor() {
72 _nsURI = "www.vamsas.ac.uk/jalview/version2";
74 _elementDefinition = true;
76 //-- set grouping compositor
77 setCompositorAsSequence();
78 org.exolab.castor.xml.util.XMLFieldDescriptorImpl desc = null;
79 org.exolab.castor.mapping.FieldHandler handler = null;
80 org.exolab.castor.xml.FieldValidator fieldValidator = null;
81 //-- initialize attribute descriptors
84 desc = new org.exolab.castor.xml.util.XMLFieldDescriptorImpl(java.lang.String.class, "_source", "source", org.exolab.castor.xml.NodeType.Attribute);
85 desc.setImmutable(true);
86 handler = new org.exolab.castor.xml.XMLFieldHandler() {
87 public java.lang.Object getValue( java.lang.Object object )
88 throws IllegalStateException
90 DBRef target = (DBRef) object;
91 return target.getSource();
93 public void setValue( java.lang.Object object, java.lang.Object value)
94 throws IllegalStateException, IllegalArgumentException
97 DBRef target = (DBRef) object;
98 target.setSource( (java.lang.String) value);
99 } catch (java.lang.Exception ex) {
100 throw new IllegalStateException(ex.toString());
103 public java.lang.Object newInstance(java.lang.Object parent) {
107 desc.setHandler(handler);
108 desc.setMultivalued(false);
109 addFieldDescriptor(desc);
111 //-- validation code for: _source
112 fieldValidator = new org.exolab.castor.xml.FieldValidator();
114 org.exolab.castor.xml.validators.StringValidator typeValidator;
115 typeValidator = new org.exolab.castor.xml.validators.StringValidator();
116 fieldValidator.setValidator(typeValidator);
117 typeValidator.setWhiteSpace("preserve");
119 desc.setValidator(fieldValidator);
121 desc = new org.exolab.castor.xml.util.XMLFieldDescriptorImpl(java.lang.String.class, "_version", "version", org.exolab.castor.xml.NodeType.Attribute);
122 desc.setImmutable(true);
123 handler = new org.exolab.castor.xml.XMLFieldHandler() {
124 public java.lang.Object getValue( java.lang.Object object )
125 throws IllegalStateException
127 DBRef target = (DBRef) object;
128 return target.getVersion();
130 public void setValue( java.lang.Object object, java.lang.Object value)
131 throws IllegalStateException, IllegalArgumentException
134 DBRef target = (DBRef) object;
135 target.setVersion( (java.lang.String) value);
136 } catch (java.lang.Exception ex) {
137 throw new IllegalStateException(ex.toString());
140 public java.lang.Object newInstance(java.lang.Object parent) {
144 desc.setHandler(handler);
145 desc.setMultivalued(false);
146 addFieldDescriptor(desc);
148 //-- validation code for: _version
149 fieldValidator = new org.exolab.castor.xml.FieldValidator();
151 org.exolab.castor.xml.validators.StringValidator typeValidator;
152 typeValidator = new org.exolab.castor.xml.validators.StringValidator();
153 fieldValidator.setValidator(typeValidator);
154 typeValidator.setWhiteSpace("preserve");
156 desc.setValidator(fieldValidator);
158 desc = new org.exolab.castor.xml.util.XMLFieldDescriptorImpl(java.lang.String.class, "_accessionId", "accessionId", org.exolab.castor.xml.NodeType.Attribute);
159 desc.setImmutable(true);
160 handler = new org.exolab.castor.xml.XMLFieldHandler() {
161 public java.lang.Object getValue( java.lang.Object object )
162 throws IllegalStateException
164 DBRef target = (DBRef) object;
165 return target.getAccessionId();
167 public void setValue( java.lang.Object object, java.lang.Object value)
168 throws IllegalStateException, IllegalArgumentException
171 DBRef target = (DBRef) object;
172 target.setAccessionId( (java.lang.String) value);
173 } catch (java.lang.Exception ex) {
174 throw new IllegalStateException(ex.toString());
177 public java.lang.Object newInstance(java.lang.Object parent) {
181 desc.setHandler(handler);
182 desc.setMultivalued(false);
183 addFieldDescriptor(desc);
185 //-- validation code for: _accessionId
186 fieldValidator = new org.exolab.castor.xml.FieldValidator();
188 org.exolab.castor.xml.validators.StringValidator typeValidator;
189 typeValidator = new org.exolab.castor.xml.validators.StringValidator();
190 fieldValidator.setValidator(typeValidator);
191 typeValidator.setWhiteSpace("preserve");
193 desc.setValidator(fieldValidator);
194 //-- initialize element descriptors
197 desc = new org.exolab.castor.xml.util.XMLFieldDescriptorImpl(jalview.schemabinding.version2.Mapping.class, "_mapping", "Mapping", org.exolab.castor.xml.NodeType.Element);
198 handler = new org.exolab.castor.xml.XMLFieldHandler() {
199 public java.lang.Object getValue( java.lang.Object object )
200 throws IllegalStateException
202 DBRef target = (DBRef) object;
203 return target.getMapping();
205 public void setValue( java.lang.Object object, java.lang.Object value)
206 throws IllegalStateException, IllegalArgumentException
209 DBRef target = (DBRef) object;
210 target.setMapping( (jalview.schemabinding.version2.Mapping) value);
211 } catch (java.lang.Exception ex) {
212 throw new IllegalStateException(ex.toString());
215 public java.lang.Object newInstance(java.lang.Object parent) {
216 return new jalview.schemabinding.version2.Mapping();
219 desc.setHandler(handler);
220 desc.setNameSpaceURI("www.vamsas.ac.uk/jalview/version2");
221 desc.setMultivalued(false);
222 addFieldDescriptor(desc);
224 //-- validation code for: _mapping
225 fieldValidator = new org.exolab.castor.xml.FieldValidator();
228 desc.setValidator(fieldValidator);
237 * Method getAccessMode.
239 * @return the access mode specified for this class.
241 public org.exolab.castor.mapping.AccessMode getAccessMode(
247 * Method getIdentity.
249 * @return the identity field, null if this class has no
252 public org.exolab.castor.mapping.FieldDescriptor getIdentity(
254 return super.getIdentity();
258 * Method getJavaClass.
260 * @return the Java class represented by this descriptor.
262 public java.lang.Class getJavaClass(
264 return jalview.schemabinding.version2.DBRef.class;
268 * Method getNameSpacePrefix.
270 * @return the namespace prefix to use when marshaling as XML.
272 public java.lang.String getNameSpacePrefix(
278 * Method getNameSpaceURI.
280 * @return the namespace URI used when marshaling and
281 * unmarshaling as XML.
283 public java.lang.String getNameSpaceURI(
289 * Method getValidator.
291 * @return a specific validator for the class described by this
294 public org.exolab.castor.xml.TypeValidator getValidator(
302 * @return the XML Name for the Class being described.
304 public java.lang.String getXMLName(
310 * Method isElementDefinition.
312 * @return true if XML schema definition of this Class is that
314 * element or element with anonymous type definition.
316 public boolean isElementDefinition(
318 return _elementDefinition;