2 * Jalview - A Sequence Alignment Editor and Viewer (Version 2.8)
3 * Copyright (C) 2012 J Procter, AM Waterhouse, LM Lui, J Engelhardt, 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/>.
18 package jalview.schemabinding.version2.descriptors;
20 //---------------------------------/
21 //- Imported classes and packages -/
22 //---------------------------------/
24 import jalview.schemabinding.version2.VAMSAS;
27 * Class VAMSASDescriptor.
29 * @version $Revision$ $Date$
31 public class VAMSASDescriptor extends
32 org.exolab.castor.xml.util.XMLClassDescriptorImpl
35 // --------------------------/
36 // - Class/Member Variables -/
37 // --------------------------/
40 * Field _elementDefinition.
42 private boolean _elementDefinition;
47 private java.lang.String _nsPrefix;
52 private java.lang.String _nsURI;
57 private java.lang.String _xmlName;
63 public VAMSASDescriptor()
66 _nsURI = "www.vamsas.ac.uk/jalview/version2";
68 _elementDefinition = false;
70 // -- set grouping compositor
71 setCompositorAsSequence();
72 org.exolab.castor.xml.util.XMLFieldDescriptorImpl desc = null;
73 org.exolab.castor.mapping.FieldHandler handler = null;
74 org.exolab.castor.xml.FieldValidator fieldValidator = null;
75 // -- initialize attribute descriptors
77 // -- initialize element descriptors
80 desc = new org.exolab.castor.xml.util.XMLFieldDescriptorImpl(
81 java.lang.String.class, "_treeList", "Tree",
82 org.exolab.castor.xml.NodeType.Element);
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 VAMSAS target = (VAMSAS) object;
90 return target.getTree();
93 public void setValue(java.lang.Object object, java.lang.Object value)
94 throws IllegalStateException, IllegalArgumentException
98 VAMSAS target = (VAMSAS) object;
99 target.addTree((java.lang.String) value);
100 } catch (java.lang.Exception ex)
102 throw new IllegalStateException(ex.toString());
106 public void resetValue(Object object) throws IllegalStateException,
107 IllegalArgumentException
111 VAMSAS target = (VAMSAS) object;
112 target.removeAllTree();
113 } catch (java.lang.Exception ex)
115 throw new IllegalStateException(ex.toString());
119 public java.lang.Object newInstance(java.lang.Object parent)
124 desc.setHandler(handler);
125 desc.setNameSpaceURI("www.vamsas.ac.uk/jalview/version2");
126 desc.setMultivalued(true);
127 addFieldDescriptor(desc);
129 // -- validation code for: _treeList
130 fieldValidator = new org.exolab.castor.xml.FieldValidator();
131 fieldValidator.setMinOccurs(0);
133 org.exolab.castor.xml.validators.StringValidator typeValidator;
134 typeValidator = new org.exolab.castor.xml.validators.StringValidator();
135 fieldValidator.setValidator(typeValidator);
136 typeValidator.setWhiteSpace("preserve");
138 desc.setValidator(fieldValidator);
139 // -- _sequenceSetList
140 desc = new org.exolab.castor.xml.util.XMLFieldDescriptorImpl(
141 jalview.schemabinding.version2.SequenceSet.class,
142 "_sequenceSetList", "SequenceSet",
143 org.exolab.castor.xml.NodeType.Element);
144 handler = new org.exolab.castor.xml.XMLFieldHandler()
146 public java.lang.Object getValue(java.lang.Object object)
147 throws IllegalStateException
149 VAMSAS target = (VAMSAS) object;
150 return target.getSequenceSet();
153 public void setValue(java.lang.Object object, java.lang.Object value)
154 throws IllegalStateException, IllegalArgumentException
158 VAMSAS target = (VAMSAS) object;
159 target.addSequenceSet((jalview.schemabinding.version2.SequenceSet) value);
160 } catch (java.lang.Exception ex)
162 throw new IllegalStateException(ex.toString());
166 public void resetValue(Object object) throws IllegalStateException,
167 IllegalArgumentException
171 VAMSAS target = (VAMSAS) object;
172 target.removeAllSequenceSet();
173 } catch (java.lang.Exception ex)
175 throw new IllegalStateException(ex.toString());
179 public java.lang.Object newInstance(java.lang.Object parent)
181 return new jalview.schemabinding.version2.SequenceSet();
184 desc.setHandler(handler);
185 desc.setNameSpaceURI("www.vamsas.ac.uk/jalview/version2");
186 desc.setMultivalued(true);
187 addFieldDescriptor(desc);
189 // -- validation code for: _sequenceSetList
190 fieldValidator = new org.exolab.castor.xml.FieldValidator();
191 fieldValidator.setMinOccurs(0);
194 desc.setValidator(fieldValidator);
202 * Method getAccessMode.
204 * @return the access mode specified for this class.
206 public org.exolab.castor.mapping.AccessMode getAccessMode()
212 * Method getIdentity.
214 * @return the identity field, null if this class has no identity.
216 public org.exolab.castor.mapping.FieldDescriptor getIdentity()
218 return super.getIdentity();
222 * Method getJavaClass.
224 * @return the Java class represented by this descriptor.
226 public java.lang.Class getJavaClass()
228 return jalview.schemabinding.version2.VAMSAS.class;
232 * Method getNameSpacePrefix.
234 * @return the namespace prefix to use when marshaling as XML.
236 public java.lang.String getNameSpacePrefix()
242 * Method getNameSpaceURI.
244 * @return the namespace URI used when marshaling and unmarshaling as XML.
246 public java.lang.String getNameSpaceURI()
252 * Method getValidator.
254 * @return a specific validator for the class described by this
257 public org.exolab.castor.xml.TypeValidator getValidator()
265 * @return the XML Name for the Class being described.
267 public java.lang.String getXMLName()
273 * Method isElementDefinition.
275 * @return true if XML schema definition of this Class is that of a global
276 * element or element with anonymous type definition.
278 public boolean isElementDefinition()
280 return _elementDefinition;