2 * Jalview - A Sequence Alignment Editor and Viewer (Version 2.8.2)
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
10 * of the License, or (at your option) any later version.
12 * Jalview is distributed in the hope that it will be useful, but
13 * WITHOUT ANY WARRANTY; without even the implied warranty
14 * of MERCHANTABILITY or FITNESS FOR A PARTICULAR
15 * PURPOSE. See the GNU General Public License for more details.
17 * You should have received a copy of the GNU General Public License
18 * along with Jalview. If not, see <http://www.gnu.org/licenses/>.
19 * The Jalview Authors are detailed in the 'AUTHORS' file.
21 package jalview.schemabinding.version2.descriptors;
23 //---------------------------------/
24 //- Imported classes and packages -/
25 //---------------------------------/
27 import jalview.schemabinding.version2.VAMSAS;
30 * Class VAMSASDescriptor.
32 * @version $Revision$ $Date$
34 public class VAMSASDescriptor extends
35 org.exolab.castor.xml.util.XMLClassDescriptorImpl
38 // --------------------------/
39 // - Class/Member Variables -/
40 // --------------------------/
43 * Field _elementDefinition.
45 private boolean _elementDefinition;
50 private java.lang.String _nsPrefix;
55 private java.lang.String _nsURI;
60 private java.lang.String _xmlName;
66 public VAMSASDescriptor()
69 _nsURI = "www.vamsas.ac.uk/jalview/version2";
71 _elementDefinition = false;
73 // -- set grouping compositor
74 setCompositorAsSequence();
75 org.exolab.castor.xml.util.XMLFieldDescriptorImpl desc = null;
76 org.exolab.castor.mapping.FieldHandler handler = null;
77 org.exolab.castor.xml.FieldValidator fieldValidator = null;
78 // -- initialize attribute descriptors
80 // -- initialize element descriptors
83 desc = new org.exolab.castor.xml.util.XMLFieldDescriptorImpl(
84 java.lang.String.class, "_treeList", "Tree",
85 org.exolab.castor.xml.NodeType.Element);
86 desc.setImmutable(true);
87 handler = new org.exolab.castor.xml.XMLFieldHandler()
89 public java.lang.Object getValue(java.lang.Object object)
90 throws IllegalStateException
92 VAMSAS target = (VAMSAS) object;
93 return target.getTree();
96 public void setValue(java.lang.Object object, java.lang.Object value)
97 throws IllegalStateException, IllegalArgumentException
101 VAMSAS target = (VAMSAS) object;
102 target.addTree((java.lang.String) value);
103 } catch (java.lang.Exception ex)
105 throw new IllegalStateException(ex.toString());
109 public void resetValue(Object object) throws IllegalStateException,
110 IllegalArgumentException
114 VAMSAS target = (VAMSAS) object;
115 target.removeAllTree();
116 } catch (java.lang.Exception ex)
118 throw new IllegalStateException(ex.toString());
122 public java.lang.Object newInstance(java.lang.Object parent)
127 desc.setHandler(handler);
128 desc.setNameSpaceURI("www.vamsas.ac.uk/jalview/version2");
129 desc.setMultivalued(true);
130 addFieldDescriptor(desc);
132 // -- validation code for: _treeList
133 fieldValidator = new org.exolab.castor.xml.FieldValidator();
134 fieldValidator.setMinOccurs(0);
136 org.exolab.castor.xml.validators.StringValidator typeValidator;
137 typeValidator = new org.exolab.castor.xml.validators.StringValidator();
138 fieldValidator.setValidator(typeValidator);
139 typeValidator.setWhiteSpace("preserve");
141 desc.setValidator(fieldValidator);
142 // -- _sequenceSetList
143 desc = new org.exolab.castor.xml.util.XMLFieldDescriptorImpl(
144 jalview.schemabinding.version2.SequenceSet.class,
145 "_sequenceSetList", "SequenceSet",
146 org.exolab.castor.xml.NodeType.Element);
147 handler = new org.exolab.castor.xml.XMLFieldHandler()
149 public java.lang.Object getValue(java.lang.Object object)
150 throws IllegalStateException
152 VAMSAS target = (VAMSAS) object;
153 return target.getSequenceSet();
156 public void setValue(java.lang.Object object, java.lang.Object value)
157 throws IllegalStateException, IllegalArgumentException
161 VAMSAS target = (VAMSAS) object;
162 target.addSequenceSet((jalview.schemabinding.version2.SequenceSet) value);
163 } catch (java.lang.Exception ex)
165 throw new IllegalStateException(ex.toString());
169 public void resetValue(Object object) throws IllegalStateException,
170 IllegalArgumentException
174 VAMSAS target = (VAMSAS) object;
175 target.removeAllSequenceSet();
176 } catch (java.lang.Exception ex)
178 throw new IllegalStateException(ex.toString());
182 public java.lang.Object newInstance(java.lang.Object parent)
184 return new jalview.schemabinding.version2.SequenceSet();
187 desc.setHandler(handler);
188 desc.setNameSpaceURI("www.vamsas.ac.uk/jalview/version2");
189 desc.setMultivalued(true);
190 addFieldDescriptor(desc);
192 // -- validation code for: _sequenceSetList
193 fieldValidator = new org.exolab.castor.xml.FieldValidator();
194 fieldValidator.setMinOccurs(0);
197 desc.setValidator(fieldValidator);
205 * Method getAccessMode.
207 * @return the access mode specified for this class.
209 public org.exolab.castor.mapping.AccessMode getAccessMode()
215 * Method getIdentity.
217 * @return the identity field, null if this class has no identity.
219 public org.exolab.castor.mapping.FieldDescriptor getIdentity()
221 return super.getIdentity();
225 * Method getJavaClass.
227 * @return the Java class represented by this descriptor.
229 public java.lang.Class getJavaClass()
231 return jalview.schemabinding.version2.VAMSAS.class;
235 * Method getNameSpacePrefix.
237 * @return the namespace prefix to use when marshaling as XML.
239 public java.lang.String getNameSpacePrefix()
245 * Method getNameSpaceURI.
247 * @return the namespace URI used when marshaling and unmarshaling as XML.
249 public java.lang.String getNameSpaceURI()
255 * Method getValidator.
257 * @return a specific validator for the class described by this
260 public org.exolab.castor.xml.TypeValidator getValidator()
268 * @return the XML Name for the Class being described.
270 public java.lang.String getXMLName()
276 * Method isElementDefinition.
278 * @return true if XML schema definition of this Class is that of a global
279 * element or element with anonymous type definition.
281 public boolean isElementDefinition()
283 return _elementDefinition;