1 /*******************************************************************************
2 * Jalview - A Sequence Alignment Editor and Viewer (Version 2.8.1)
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.
17 * If not, see <http://www.gnu.org/licenses/>.
18 * The Jalview Authors are detailed in the 'AUTHORS' file.
19 ******************************************************************************/
21 * This class was automatically generated with
22 * <a href="http://www.castor.org">Castor 1.1</a>, using an XML
27 package jalview.schemabinding.version2.descriptors;
29 //---------------------------------/
30 //- Imported classes and packages -/
31 //---------------------------------/
33 import jalview.schemabinding.version2.Group;
36 * Class GroupDescriptor.
38 * @version $Revision$ $Date$
40 public class GroupDescriptor extends
41 org.exolab.castor.xml.util.XMLClassDescriptorImpl
44 // --------------------------/
45 // - Class/Member Variables -/
46 // --------------------------/
49 * Field _elementDefinition.
51 private boolean _elementDefinition;
56 private java.lang.String _nsPrefix;
61 private java.lang.String _nsURI;
66 private java.lang.String _xmlName;
72 public GroupDescriptor()
75 _nsURI = "www.jalview.org";
77 _elementDefinition = true;
78 org.exolab.castor.xml.util.XMLFieldDescriptorImpl desc = null;
79 org.exolab.castor.mapping.FieldHandler handler = null;
80 org.exolab.castor.xml.FieldValidator fieldValidator = null;
81 // -- initialize attribute descriptors
84 desc = new org.exolab.castor.xml.util.XMLFieldDescriptorImpl(
85 java.lang.String.class, "_name", "name",
86 org.exolab.castor.xml.NodeType.Attribute);
87 desc.setImmutable(true);
88 handler = new org.exolab.castor.xml.XMLFieldHandler()
90 public java.lang.Object getValue(java.lang.Object object)
91 throws IllegalStateException
93 Group target = (Group) object;
94 return target.getName();
97 public void setValue(java.lang.Object object, java.lang.Object value)
98 throws IllegalStateException, IllegalArgumentException
102 Group target = (Group) object;
103 target.setName((java.lang.String) value);
104 } catch (java.lang.Exception ex)
106 throw new IllegalStateException(ex.toString());
110 public java.lang.Object newInstance(java.lang.Object parent)
115 desc.setHandler(handler);
116 desc.setRequired(true);
117 desc.setMultivalued(false);
118 addFieldDescriptor(desc);
120 // -- validation code for: _name
121 fieldValidator = new org.exolab.castor.xml.FieldValidator();
122 fieldValidator.setMinOccurs(1);
124 org.exolab.castor.xml.validators.StringValidator typeValidator;
125 typeValidator = new org.exolab.castor.xml.validators.StringValidator();
126 fieldValidator.setValidator(typeValidator);
127 typeValidator.setWhiteSpace("preserve");
129 desc.setValidator(fieldValidator);
131 desc = new org.exolab.castor.xml.util.XMLFieldDescriptorImpl(
132 java.lang.Boolean.TYPE, "_display", "display",
133 org.exolab.castor.xml.NodeType.Attribute);
134 handler = new org.exolab.castor.xml.XMLFieldHandler()
136 public java.lang.Object getValue(java.lang.Object object)
137 throws IllegalStateException
139 Group target = (Group) object;
140 if (!target.hasDisplay())
144 return (target.getDisplay() ? java.lang.Boolean.TRUE
145 : java.lang.Boolean.FALSE);
148 public void setValue(java.lang.Object object, java.lang.Object value)
149 throws IllegalStateException, IllegalArgumentException
153 Group target = (Group) object;
154 // ignore null values for non optional primitives
160 target.setDisplay(((java.lang.Boolean) value).booleanValue());
161 } catch (java.lang.Exception ex)
163 throw new IllegalStateException(ex.toString());
167 public java.lang.Object newInstance(java.lang.Object parent)
172 desc.setHandler(handler);
173 desc.setRequired(true);
174 desc.setMultivalued(false);
175 addFieldDescriptor(desc);
177 // -- validation code for: _display
178 fieldValidator = new org.exolab.castor.xml.FieldValidator();
179 fieldValidator.setMinOccurs(1);
181 org.exolab.castor.xml.validators.BooleanValidator typeValidator;
182 typeValidator = new org.exolab.castor.xml.validators.BooleanValidator();
183 fieldValidator.setValidator(typeValidator);
185 desc.setValidator(fieldValidator);
186 // -- initialize element descriptors
195 * Method getAccessMode.
197 * @return the access mode specified for this class.
199 public org.exolab.castor.mapping.AccessMode getAccessMode()
205 * Method getIdentity.
207 * @return the identity field, null if this class has no identity.
209 public org.exolab.castor.mapping.FieldDescriptor getIdentity()
211 return super.getIdentity();
215 * Method getJavaClass.
217 * @return the Java class represented by this descriptor.
219 public java.lang.Class getJavaClass()
221 return jalview.schemabinding.version2.Group.class;
225 * Method getNameSpacePrefix.
227 * @return the namespace prefix to use when marshaling as XML.
229 public java.lang.String getNameSpacePrefix()
235 * Method getNameSpaceURI.
237 * @return the namespace URI used when marshaling and unmarshaling as XML.
239 public java.lang.String getNameSpaceURI()
245 * Method getValidator.
247 * @return a specific validator for the class described by this
250 public org.exolab.castor.xml.TypeValidator getValidator()
258 * @return the XML Name for the Class being described.
260 public java.lang.String getXMLName()
266 * Method isElementDefinition.
268 * @return true if XML schema definition of this Class is that of a global
269 * element or element with anonymous type definition.
271 public boolean isElementDefinition()
273 return _elementDefinition;