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.FeatureSettings;
28 * Class FeatureSettingsDescriptor.
30 * @version $Revision$ $Date$
32 public class FeatureSettingsDescriptor 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 FeatureSettingsDescriptor()
67 _nsURI = "www.jalview.org";
68 _xmlName = "FeatureSettings";
69 _elementDefinition = true;
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 jalview.schemabinding.version2.Setting.class, "_settingList",
83 "setting", org.exolab.castor.xml.NodeType.Element);
84 handler = new org.exolab.castor.xml.XMLFieldHandler()
86 public java.lang.Object getValue(java.lang.Object object)
87 throws IllegalStateException
89 FeatureSettings target = (FeatureSettings) object;
90 return target.getSetting();
93 public void setValue(java.lang.Object object, java.lang.Object value)
94 throws IllegalStateException, IllegalArgumentException
98 FeatureSettings target = (FeatureSettings) object;
99 target.addSetting((jalview.schemabinding.version2.Setting) value);
100 } catch (java.lang.Exception ex)
102 throw new IllegalStateException(ex.toString());
106 public void resetValue(Object object) throws IllegalStateException,
107 IllegalArgumentException
111 FeatureSettings target = (FeatureSettings) object;
112 target.removeAllSetting();
113 } catch (java.lang.Exception ex)
115 throw new IllegalStateException(ex.toString());
119 public java.lang.Object newInstance(java.lang.Object parent)
121 return new jalview.schemabinding.version2.Setting();
124 desc.setHandler(handler);
125 desc.setNameSpaceURI("www.jalview.org");
126 desc.setMultivalued(true);
127 addFieldDescriptor(desc);
129 // -- validation code for: _settingList
130 fieldValidator = new org.exolab.castor.xml.FieldValidator();
131 fieldValidator.setMinOccurs(0);
134 desc.setValidator(fieldValidator);
136 desc = new org.exolab.castor.xml.util.XMLFieldDescriptorImpl(
137 jalview.schemabinding.version2.Group.class, "_groupList",
138 "group", org.exolab.castor.xml.NodeType.Element);
139 handler = new org.exolab.castor.xml.XMLFieldHandler()
141 public java.lang.Object getValue(java.lang.Object object)
142 throws IllegalStateException
144 FeatureSettings target = (FeatureSettings) object;
145 return target.getGroup();
148 public void setValue(java.lang.Object object, java.lang.Object value)
149 throws IllegalStateException, IllegalArgumentException
153 FeatureSettings target = (FeatureSettings) object;
154 target.addGroup((jalview.schemabinding.version2.Group) value);
155 } catch (java.lang.Exception ex)
157 throw new IllegalStateException(ex.toString());
161 public void resetValue(Object object) throws IllegalStateException,
162 IllegalArgumentException
166 FeatureSettings target = (FeatureSettings) object;
167 target.removeAllGroup();
168 } catch (java.lang.Exception ex)
170 throw new IllegalStateException(ex.toString());
174 public java.lang.Object newInstance(java.lang.Object parent)
176 return new jalview.schemabinding.version2.Group();
179 desc.setHandler(handler);
180 desc.setNameSpaceURI("www.jalview.org");
181 desc.setMultivalued(true);
182 addFieldDescriptor(desc);
184 // -- validation code for: _groupList
185 fieldValidator = new org.exolab.castor.xml.FieldValidator();
186 fieldValidator.setMinOccurs(0);
189 desc.setValidator(fieldValidator);
197 * Method getAccessMode.
199 * @return the access mode specified for this class.
201 public org.exolab.castor.mapping.AccessMode getAccessMode()
207 * Method getIdentity.
209 * @return the identity field, null if this class has no identity.
211 public org.exolab.castor.mapping.FieldDescriptor getIdentity()
213 return super.getIdentity();
217 * Method getJavaClass.
219 * @return the Java class represented by this descriptor.
221 public java.lang.Class getJavaClass()
223 return jalview.schemabinding.version2.FeatureSettings.class;
227 * Method getNameSpacePrefix.
229 * @return the namespace prefix to use when marshaling as XML.
231 public java.lang.String getNameSpacePrefix()
237 * Method getNameSpaceURI.
239 * @return the namespace URI used when marshaling and unmarshaling as XML.
241 public java.lang.String getNameSpaceURI()
247 * Method getValidator.
249 * @return a specific validator for the class described by this
252 public org.exolab.castor.xml.TypeValidator getValidator()
260 * @return the XML Name for the Class being described.
262 public java.lang.String getXMLName()
268 * Method isElementDefinition.
270 * @return true if XML schema definition of this Class is that of a global
271 * element or element with anonymous type definition.
273 public boolean isElementDefinition()
275 return _elementDefinition;