2 * Jalview - A Sequence Alignment Editor and Viewer (Version 2.8.0b1)
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. If not, see <http://www.gnu.org/licenses/>.
17 * The Jalview Authors are detailed in the 'AUTHORS' file.
19 package jalview.schemabinding.version2.descriptors;
21 //---------------------------------/
22 //- Imported classes and packages -/
23 //---------------------------------/
25 import jalview.schemabinding.version2.Sequence;
28 * Class SequenceDescriptor.
30 * @version $Revision$ $Date$
32 public class SequenceDescriptor extends
33 jalview.schemabinding.version2.descriptors.SequenceTypeDescriptor
36 // --------------------------/
37 // - Class/Member Variables -/
38 // --------------------------/
41 * Field _elementDefinition.
43 private boolean _elementDefinition;
48 private java.lang.String _nsPrefix;
53 private java.lang.String _nsURI;
58 private java.lang.String _xmlName;
64 public SequenceDescriptor()
67 setExtendsWithoutFlatten(new jalview.schemabinding.version2.descriptors.SequenceTypeDescriptor());
68 _nsURI = "www.vamsas.ac.uk/jalview/version2";
69 _xmlName = "Sequence";
70 _elementDefinition = true;
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
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()
86 public java.lang.Object getValue(java.lang.Object object)
87 throws IllegalStateException
89 Sequence target = (Sequence) object;
90 return target.getDsseqid();
93 public void setValue(java.lang.Object object, java.lang.Object value)
94 throws IllegalStateException, IllegalArgumentException
98 Sequence target = (Sequence) object;
99 target.setDsseqid((java.lang.String) value);
100 } catch (java.lang.Exception ex)
102 throw new IllegalStateException(ex.toString());
106 public java.lang.Object newInstance(java.lang.Object parent)
111 desc.setHandler(handler);
112 desc.setMultivalued(false);
113 addFieldDescriptor(desc);
115 // -- validation code for: _dsseqid
116 fieldValidator = new org.exolab.castor.xml.FieldValidator();
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");
123 desc.setValidator(fieldValidator);
124 // -- initialize element descriptors
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()
132 public java.lang.Object getValue(java.lang.Object object)
133 throws IllegalStateException
135 Sequence target = (Sequence) object;
136 return target.getDBRef();
139 public void setValue(java.lang.Object object, java.lang.Object value)
140 throws IllegalStateException, IllegalArgumentException
144 Sequence target = (Sequence) object;
145 target.addDBRef((jalview.schemabinding.version2.DBRef) value);
146 } catch (java.lang.Exception ex)
148 throw new IllegalStateException(ex.toString());
152 public void resetValue(Object object) throws IllegalStateException,
153 IllegalArgumentException
157 Sequence target = (Sequence) object;
158 target.removeAllDBRef();
159 } catch (java.lang.Exception ex)
161 throw new IllegalStateException(ex.toString());
165 public java.lang.Object newInstance(java.lang.Object parent)
167 return new jalview.schemabinding.version2.DBRef();
170 desc.setHandler(handler);
171 desc.setNameSpaceURI("www.vamsas.ac.uk/jalview/version2");
172 desc.setMultivalued(true);
173 addFieldDescriptor(desc);
175 // -- validation code for: _DBRefList
176 fieldValidator = new org.exolab.castor.xml.FieldValidator();
177 fieldValidator.setMinOccurs(0);
180 desc.setValidator(fieldValidator);
188 * Method getAccessMode.
190 * @return the access mode specified for this class.
192 public org.exolab.castor.mapping.AccessMode getAccessMode()
198 * Method getIdentity.
200 * @return the identity field, null if this class has no identity.
202 public org.exolab.castor.mapping.FieldDescriptor getIdentity()
204 return super.getIdentity();
208 * Method getJavaClass.
210 * @return the Java class represented by this descriptor.
212 public java.lang.Class getJavaClass()
214 return jalview.schemabinding.version2.Sequence.class;
218 * Method getNameSpacePrefix.
220 * @return the namespace prefix to use when marshaling as XML.
222 public java.lang.String getNameSpacePrefix()
228 * Method getNameSpaceURI.
230 * @return the namespace URI used when marshaling and unmarshaling as XML.
232 public java.lang.String getNameSpaceURI()
238 * Method getValidator.
240 * @return a specific validator for the class described by this
243 public org.exolab.castor.xml.TypeValidator getValidator()
251 * @return the XML Name for the Class being described.
253 public java.lang.String getXMLName()
259 * Method isElementDefinition.
261 * @return true if XML schema definition of this Class is that of a global
262 * element or element with anonymous type definition.
264 public boolean isElementDefinition()
266 return _elementDefinition;