2 * Jalview - A Sequence Alignment Editor and Viewer ($$Version-Rel$$)
3 * Copyright (C) $$Year-Rel$$ 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.MappingChoice;
30 * Class MappingChoiceDescriptor.
32 * @version $Revision$ $Date$
34 public class MappingChoiceDescriptor 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 MappingChoiceDescriptor()
69 _nsURI = "www.vamsas.ac.uk/jalview/version2";
70 _elementDefinition = false;
72 // -- set grouping compositor
73 setCompositorAsChoice();
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
79 // -- initialize element descriptors
82 desc = new org.exolab.castor.xml.util.XMLFieldDescriptorImpl(
83 jalview.schemabinding.version2.Sequence.class, "_sequence",
84 "Sequence", org.exolab.castor.xml.NodeType.Element);
85 handler = new org.exolab.castor.xml.XMLFieldHandler()
87 public java.lang.Object getValue(java.lang.Object object)
88 throws IllegalStateException
90 MappingChoice target = (MappingChoice) object;
91 return target.getSequence();
94 public void setValue(java.lang.Object object, java.lang.Object value)
95 throws IllegalStateException, IllegalArgumentException
99 MappingChoice target = (MappingChoice) object;
100 target.setSequence((jalview.schemabinding.version2.Sequence) value);
101 } catch (java.lang.Exception ex)
103 throw new IllegalStateException(ex.toString());
107 public java.lang.Object newInstance(java.lang.Object parent)
109 return new jalview.schemabinding.version2.Sequence();
112 desc.setHandler(handler);
113 desc.setNameSpaceURI("www.vamsas.ac.uk/jalview/version2");
114 desc.setMultivalued(false);
115 addFieldDescriptor(desc);
117 // -- validation code for: _sequence
118 fieldValidator = new org.exolab.castor.xml.FieldValidator();
121 desc.setValidator(fieldValidator);
123 desc = new org.exolab.castor.xml.util.XMLFieldDescriptorImpl(
124 java.lang.String.class, "_dseqFor", "dseqFor",
125 org.exolab.castor.xml.NodeType.Element);
126 desc.setImmutable(true);
127 handler = new org.exolab.castor.xml.XMLFieldHandler()
129 public java.lang.Object getValue(java.lang.Object object)
130 throws IllegalStateException
132 MappingChoice target = (MappingChoice) object;
133 return target.getDseqFor();
136 public void setValue(java.lang.Object object, java.lang.Object value)
137 throws IllegalStateException, IllegalArgumentException
141 MappingChoice target = (MappingChoice) object;
142 target.setDseqFor((java.lang.String) value);
143 } catch (java.lang.Exception ex)
145 throw new IllegalStateException(ex.toString());
149 public java.lang.Object newInstance(java.lang.Object parent)
154 desc.setHandler(handler);
155 desc.setNameSpaceURI("www.vamsas.ac.uk/jalview/version2");
156 desc.setMultivalued(false);
157 addFieldDescriptor(desc);
159 // -- validation code for: _dseqFor
160 fieldValidator = new org.exolab.castor.xml.FieldValidator();
162 org.exolab.castor.xml.validators.StringValidator typeValidator;
163 typeValidator = new org.exolab.castor.xml.validators.StringValidator();
164 fieldValidator.setValidator(typeValidator);
165 typeValidator.setWhiteSpace("preserve");
167 desc.setValidator(fieldValidator);
175 * Method getAccessMode.
177 * @return the access mode specified for this class.
179 public org.exolab.castor.mapping.AccessMode getAccessMode()
185 * Method getIdentity.
187 * @return the identity field, null if this class has no identity.
189 public org.exolab.castor.mapping.FieldDescriptor getIdentity()
191 return super.getIdentity();
195 * Method getJavaClass.
197 * @return the Java class represented by this descriptor.
199 public java.lang.Class getJavaClass()
201 return jalview.schemabinding.version2.MappingChoice.class;
205 * Method getNameSpacePrefix.
207 * @return the namespace prefix to use when marshaling as XML.
209 public java.lang.String getNameSpacePrefix()
215 * Method getNameSpaceURI.
217 * @return the namespace URI used when marshaling and unmarshaling as XML.
219 public java.lang.String getNameSpaceURI()
225 * Method getValidator.
227 * @return a specific validator for the class described by this
230 public org.exolab.castor.xml.TypeValidator getValidator()
238 * @return the XML Name for the Class being described.
240 public java.lang.String getXMLName()
246 * Method isElementDefinition.
248 * @return true if XML schema definition of this Class is that of a global
249 * element or element with anonymous type definition.
251 public boolean isElementDefinition()
253 return _elementDefinition;