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.VAMSAS;
28 * Class VAMSASDescriptor.
30 * @version $Revision$ $Date$
32 public class VAMSASDescriptor extends
33 org.exolab.castor.xml.util.XMLClassDescriptorImpl
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 VAMSASDescriptor()
67 _nsURI = "www.vamsas.ac.uk/jalview/version2";
69 _elementDefinition = false;
71 // -- set grouping compositor
72 setCompositorAsSequence();
73 org.exolab.castor.xml.util.XMLFieldDescriptorImpl desc = null;
74 org.exolab.castor.mapping.FieldHandler handler = null;
75 org.exolab.castor.xml.FieldValidator fieldValidator = null;
76 // -- initialize attribute descriptors
78 // -- initialize element descriptors
81 desc = new org.exolab.castor.xml.util.XMLFieldDescriptorImpl(
82 java.lang.String.class, "_treeList", "Tree",
83 org.exolab.castor.xml.NodeType.Element);
84 desc.setImmutable(true);
85 handler = new org.exolab.castor.xml.XMLFieldHandler()
87 public java.lang.Object getValue(java.lang.Object object)
88 throws IllegalStateException
90 VAMSAS target = (VAMSAS) object;
91 return target.getTree();
94 public void setValue(java.lang.Object object, java.lang.Object value)
95 throws IllegalStateException, IllegalArgumentException
99 VAMSAS target = (VAMSAS) object;
100 target.addTree((java.lang.String) value);
101 } catch (java.lang.Exception ex)
103 throw new IllegalStateException(ex.toString());
107 public void resetValue(Object object) throws IllegalStateException,
108 IllegalArgumentException
112 VAMSAS target = (VAMSAS) object;
113 target.removeAllTree();
114 } catch (java.lang.Exception ex)
116 throw new IllegalStateException(ex.toString());
120 public java.lang.Object newInstance(java.lang.Object parent)
125 desc.setHandler(handler);
126 desc.setNameSpaceURI("www.vamsas.ac.uk/jalview/version2");
127 desc.setMultivalued(true);
128 addFieldDescriptor(desc);
130 // -- validation code for: _treeList
131 fieldValidator = new org.exolab.castor.xml.FieldValidator();
132 fieldValidator.setMinOccurs(0);
134 org.exolab.castor.xml.validators.StringValidator typeValidator;
135 typeValidator = new org.exolab.castor.xml.validators.StringValidator();
136 fieldValidator.setValidator(typeValidator);
137 typeValidator.setWhiteSpace("preserve");
139 desc.setValidator(fieldValidator);
140 // -- _sequenceSetList
141 desc = new org.exolab.castor.xml.util.XMLFieldDescriptorImpl(
142 jalview.schemabinding.version2.SequenceSet.class,
143 "_sequenceSetList", "SequenceSet",
144 org.exolab.castor.xml.NodeType.Element);
145 handler = new org.exolab.castor.xml.XMLFieldHandler()
147 public java.lang.Object getValue(java.lang.Object object)
148 throws IllegalStateException
150 VAMSAS target = (VAMSAS) object;
151 return target.getSequenceSet();
154 public void setValue(java.lang.Object object, java.lang.Object value)
155 throws IllegalStateException, IllegalArgumentException
159 VAMSAS target = (VAMSAS) object;
160 target.addSequenceSet((jalview.schemabinding.version2.SequenceSet) value);
161 } catch (java.lang.Exception ex)
163 throw new IllegalStateException(ex.toString());
167 public void resetValue(Object object) throws IllegalStateException,
168 IllegalArgumentException
172 VAMSAS target = (VAMSAS) object;
173 target.removeAllSequenceSet();
174 } catch (java.lang.Exception ex)
176 throw new IllegalStateException(ex.toString());
180 public java.lang.Object newInstance(java.lang.Object parent)
182 return new jalview.schemabinding.version2.SequenceSet();
185 desc.setHandler(handler);
186 desc.setNameSpaceURI("www.vamsas.ac.uk/jalview/version2");
187 desc.setMultivalued(true);
188 addFieldDescriptor(desc);
190 // -- validation code for: _sequenceSetList
191 fieldValidator = new org.exolab.castor.xml.FieldValidator();
192 fieldValidator.setMinOccurs(0);
195 desc.setValidator(fieldValidator);
203 * Method getAccessMode.
205 * @return the access mode specified for this class.
207 public org.exolab.castor.mapping.AccessMode getAccessMode()
213 * Method getIdentity.
215 * @return the identity field, null if this class has no identity.
217 public org.exolab.castor.mapping.FieldDescriptor getIdentity()
219 return super.getIdentity();
223 * Method getJavaClass.
225 * @return the Java class represented by this descriptor.
227 public java.lang.Class getJavaClass()
229 return jalview.schemabinding.version2.VAMSAS.class;
233 * Method getNameSpacePrefix.
235 * @return the namespace prefix to use when marshaling as XML.
237 public java.lang.String getNameSpacePrefix()
243 * Method getNameSpaceURI.
245 * @return the namespace URI used when marshaling and unmarshaling as XML.
247 public java.lang.String getNameSpaceURI()
253 * Method getValidator.
255 * @return a specific validator for the class described by this
258 public org.exolab.castor.xml.TypeValidator getValidator()
266 * @return the XML Name for the Class being described.
268 public java.lang.String getXMLName()
274 * Method isElementDefinition.
276 * @return true if XML schema definition of this Class is that of a global
277 * element or element with anonymous type definition.
279 public boolean isElementDefinition()
281 return _elementDefinition;