1 /*******************************************************************************
2 * Jalview - A Sequence Alignment Editor and Viewer (Version 2.8.1)
3 * Copyright (C) 2014 The Jalview Authors
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.
17 * If not, see <http://www.gnu.org/licenses/>.
18 * The Jalview Authors are detailed in the 'AUTHORS' file.
19 ******************************************************************************/
21 * This class was automatically generated with
22 * <a href="http://www.castor.org">Castor 1.1</a>, using an XML
27 package jalview.schemabinding.version2.descriptors;
29 //---------------------------------/
30 //- Imported classes and packages -/
31 //---------------------------------/
33 import jalview.schemabinding.version2.DBRef;
36 * Class DBRefDescriptor.
38 * @version $Revision$ $Date$
40 public class DBRefDescriptor extends
41 org.exolab.castor.xml.util.XMLClassDescriptorImpl
44 // --------------------------/
45 // - Class/Member Variables -/
46 // --------------------------/
49 * Field _elementDefinition.
51 private boolean _elementDefinition;
56 private java.lang.String _nsPrefix;
61 private java.lang.String _nsURI;
66 private java.lang.String _xmlName;
72 public DBRefDescriptor()
75 _nsURI = "www.vamsas.ac.uk/jalview/version2";
77 _elementDefinition = true;
79 // -- set grouping compositor
80 setCompositorAsSequence();
81 org.exolab.castor.xml.util.XMLFieldDescriptorImpl desc = null;
82 org.exolab.castor.mapping.FieldHandler handler = null;
83 org.exolab.castor.xml.FieldValidator fieldValidator = null;
84 // -- initialize attribute descriptors
87 desc = new org.exolab.castor.xml.util.XMLFieldDescriptorImpl(
88 java.lang.String.class, "_source", "source",
89 org.exolab.castor.xml.NodeType.Attribute);
90 desc.setImmutable(true);
91 handler = new org.exolab.castor.xml.XMLFieldHandler()
93 public java.lang.Object getValue(java.lang.Object object)
94 throws IllegalStateException
96 DBRef target = (DBRef) object;
97 return target.getSource();
100 public void setValue(java.lang.Object object, java.lang.Object value)
101 throws IllegalStateException, IllegalArgumentException
105 DBRef target = (DBRef) object;
106 target.setSource((java.lang.String) value);
107 } catch (java.lang.Exception ex)
109 throw new IllegalStateException(ex.toString());
113 public java.lang.Object newInstance(java.lang.Object parent)
118 desc.setHandler(handler);
119 desc.setMultivalued(false);
120 addFieldDescriptor(desc);
122 // -- validation code for: _source
123 fieldValidator = new org.exolab.castor.xml.FieldValidator();
125 org.exolab.castor.xml.validators.StringValidator typeValidator;
126 typeValidator = new org.exolab.castor.xml.validators.StringValidator();
127 fieldValidator.setValidator(typeValidator);
128 typeValidator.setWhiteSpace("preserve");
130 desc.setValidator(fieldValidator);
132 desc = new org.exolab.castor.xml.util.XMLFieldDescriptorImpl(
133 java.lang.String.class, "_version", "version",
134 org.exolab.castor.xml.NodeType.Attribute);
135 desc.setImmutable(true);
136 handler = new org.exolab.castor.xml.XMLFieldHandler()
138 public java.lang.Object getValue(java.lang.Object object)
139 throws IllegalStateException
141 DBRef target = (DBRef) object;
142 return target.getVersion();
145 public void setValue(java.lang.Object object, java.lang.Object value)
146 throws IllegalStateException, IllegalArgumentException
150 DBRef target = (DBRef) object;
151 target.setVersion((java.lang.String) value);
152 } catch (java.lang.Exception ex)
154 throw new IllegalStateException(ex.toString());
158 public java.lang.Object newInstance(java.lang.Object parent)
163 desc.setHandler(handler);
164 desc.setMultivalued(false);
165 addFieldDescriptor(desc);
167 // -- validation code for: _version
168 fieldValidator = new org.exolab.castor.xml.FieldValidator();
170 org.exolab.castor.xml.validators.StringValidator typeValidator;
171 typeValidator = new org.exolab.castor.xml.validators.StringValidator();
172 fieldValidator.setValidator(typeValidator);
173 typeValidator.setWhiteSpace("preserve");
175 desc.setValidator(fieldValidator);
177 desc = new org.exolab.castor.xml.util.XMLFieldDescriptorImpl(
178 java.lang.String.class, "_accessionId", "accessionId",
179 org.exolab.castor.xml.NodeType.Attribute);
180 desc.setImmutable(true);
181 handler = new org.exolab.castor.xml.XMLFieldHandler()
183 public java.lang.Object getValue(java.lang.Object object)
184 throws IllegalStateException
186 DBRef target = (DBRef) object;
187 return target.getAccessionId();
190 public void setValue(java.lang.Object object, java.lang.Object value)
191 throws IllegalStateException, IllegalArgumentException
195 DBRef target = (DBRef) object;
196 target.setAccessionId((java.lang.String) value);
197 } catch (java.lang.Exception ex)
199 throw new IllegalStateException(ex.toString());
203 public java.lang.Object newInstance(java.lang.Object parent)
208 desc.setHandler(handler);
209 desc.setMultivalued(false);
210 addFieldDescriptor(desc);
212 // -- validation code for: _accessionId
213 fieldValidator = new org.exolab.castor.xml.FieldValidator();
215 org.exolab.castor.xml.validators.StringValidator typeValidator;
216 typeValidator = new org.exolab.castor.xml.validators.StringValidator();
217 fieldValidator.setValidator(typeValidator);
218 typeValidator.setWhiteSpace("preserve");
220 desc.setValidator(fieldValidator);
221 // -- initialize element descriptors
224 desc = new org.exolab.castor.xml.util.XMLFieldDescriptorImpl(
225 jalview.schemabinding.version2.Mapping.class, "_mapping",
226 "Mapping", org.exolab.castor.xml.NodeType.Element);
227 handler = new org.exolab.castor.xml.XMLFieldHandler()
229 public java.lang.Object getValue(java.lang.Object object)
230 throws IllegalStateException
232 DBRef target = (DBRef) object;
233 return target.getMapping();
236 public void setValue(java.lang.Object object, java.lang.Object value)
237 throws IllegalStateException, IllegalArgumentException
241 DBRef target = (DBRef) object;
242 target.setMapping((jalview.schemabinding.version2.Mapping) value);
243 } catch (java.lang.Exception ex)
245 throw new IllegalStateException(ex.toString());
249 public java.lang.Object newInstance(java.lang.Object parent)
251 return new jalview.schemabinding.version2.Mapping();
254 desc.setHandler(handler);
255 desc.setNameSpaceURI("www.vamsas.ac.uk/jalview/version2");
256 desc.setMultivalued(false);
257 addFieldDescriptor(desc);
259 // -- validation code for: _mapping
260 fieldValidator = new org.exolab.castor.xml.FieldValidator();
263 desc.setValidator(fieldValidator);
271 * Method getAccessMode.
273 * @return the access mode specified for this class.
275 public org.exolab.castor.mapping.AccessMode getAccessMode()
281 * Method getIdentity.
283 * @return the identity field, null if this class has no identity.
285 public org.exolab.castor.mapping.FieldDescriptor getIdentity()
287 return super.getIdentity();
291 * Method getJavaClass.
293 * @return the Java class represented by this descriptor.
295 public java.lang.Class getJavaClass()
297 return jalview.schemabinding.version2.DBRef.class;
301 * Method getNameSpacePrefix.
303 * @return the namespace prefix to use when marshaling as XML.
305 public java.lang.String getNameSpacePrefix()
311 * Method getNameSpaceURI.
313 * @return the namespace URI used when marshaling and unmarshaling as XML.
315 public java.lang.String getNameSpaceURI()
321 * Method getValidator.
323 * @return a specific validator for the class described by this
326 public org.exolab.castor.xml.TypeValidator getValidator()
334 * @return the XML Name for the Class being described.
336 public java.lang.String getXMLName()
342 * Method isElementDefinition.
344 * @return true if XML schema definition of this Class is that of a global
345 * element or element with anonymous type definition.
347 public boolean isElementDefinition()
349 return _elementDefinition;