2 * Jalview - A Sequence Alignment Editor and Viewer (Version 2.8.2)
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
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.Colour;
28 import jalview.schemabinding.version2.JalviewUserColours;
31 * Class JalviewUserColoursDescriptor.
33 * @version $Revision$ $Date$
35 public class JalviewUserColoursDescriptor extends
36 org.exolab.castor.xml.util.XMLClassDescriptorImpl
39 // --------------------------/
40 // - Class/Member Variables -/
41 // --------------------------/
44 * Field _elementDefinition.
46 private boolean _elementDefinition;
51 private java.lang.String _nsPrefix;
56 private java.lang.String _nsURI;
61 private java.lang.String _xmlName;
67 public JalviewUserColoursDescriptor()
70 _nsURI = "www.jalview.org/colours";
71 _xmlName = "JalviewUserColours";
72 _elementDefinition = false;
74 // -- set grouping compositor
75 setCompositorAsSequence();
76 org.exolab.castor.xml.util.XMLFieldDescriptorImpl desc = null;
77 org.exolab.castor.mapping.FieldHandler handler = null;
78 org.exolab.castor.xml.FieldValidator fieldValidator = null;
79 // -- initialize attribute descriptors
82 desc = new org.exolab.castor.xml.util.XMLFieldDescriptorImpl(
83 java.lang.String.class, "_schemeName", "schemeName",
84 org.exolab.castor.xml.NodeType.Attribute);
85 desc.setImmutable(true);
86 handler = new org.exolab.castor.xml.XMLFieldHandler()
88 public java.lang.Object getValue(java.lang.Object object)
89 throws IllegalStateException
91 JalviewUserColours target = (JalviewUserColours) object;
92 return target.getSchemeName();
95 public void setValue(java.lang.Object object, java.lang.Object value)
96 throws IllegalStateException, IllegalArgumentException
100 JalviewUserColours target = (JalviewUserColours) object;
101 target.setSchemeName((java.lang.String) value);
102 } catch (java.lang.Exception ex)
104 throw new IllegalStateException(ex.toString());
108 public java.lang.Object newInstance(java.lang.Object parent)
113 desc.setHandler(handler);
114 desc.setMultivalued(false);
115 addFieldDescriptor(desc);
117 // -- validation code for: _schemeName
118 fieldValidator = new org.exolab.castor.xml.FieldValidator();
120 org.exolab.castor.xml.validators.StringValidator typeValidator;
121 typeValidator = new org.exolab.castor.xml.validators.StringValidator();
122 fieldValidator.setValidator(typeValidator);
123 typeValidator.setWhiteSpace("preserve");
125 desc.setValidator(fieldValidator);
126 // -- initialize element descriptors
129 desc = new org.exolab.castor.xml.util.XMLFieldDescriptorImpl(
130 java.lang.String.class, "_version", "Version",
131 org.exolab.castor.xml.NodeType.Element);
132 desc.setImmutable(true);
133 handler = new org.exolab.castor.xml.XMLFieldHandler()
135 public java.lang.Object getValue(java.lang.Object object)
136 throws IllegalStateException
138 JalviewUserColours target = (JalviewUserColours) object;
139 return target.getVersion();
142 public void setValue(java.lang.Object object, java.lang.Object value)
143 throws IllegalStateException, IllegalArgumentException
147 JalviewUserColours target = (JalviewUserColours) object;
148 target.setVersion((java.lang.String) value);
149 } catch (java.lang.Exception ex)
151 throw new IllegalStateException(ex.toString());
155 public java.lang.Object newInstance(java.lang.Object parent)
160 desc.setHandler(handler);
161 desc.setMultivalued(false);
162 addFieldDescriptor(desc);
164 // -- validation code for: _version
165 fieldValidator = new org.exolab.castor.xml.FieldValidator();
167 org.exolab.castor.xml.validators.StringValidator typeValidator;
168 typeValidator = new org.exolab.castor.xml.validators.StringValidator();
169 fieldValidator.setValidator(typeValidator);
170 typeValidator.setWhiteSpace("preserve");
172 desc.setValidator(fieldValidator);
174 desc = new org.exolab.castor.xml.util.XMLFieldDescriptorImpl(
175 Colour.class, "_colourList", "colour",
176 org.exolab.castor.xml.NodeType.Element);
177 handler = new org.exolab.castor.xml.XMLFieldHandler()
179 public java.lang.Object getValue(java.lang.Object object)
180 throws IllegalStateException
182 JalviewUserColours target = (JalviewUserColours) object;
183 return target.getColour();
186 public void setValue(java.lang.Object object, java.lang.Object value)
187 throws IllegalStateException, IllegalArgumentException
191 JalviewUserColours target = (JalviewUserColours) object;
192 target.addColour((Colour) value);
193 } catch (java.lang.Exception ex)
195 throw new IllegalStateException(ex.toString());
199 public void resetValue(Object object) throws IllegalStateException,
200 IllegalArgumentException
204 JalviewUserColours target = (JalviewUserColours) object;
205 target.removeAllColour();
206 } catch (java.lang.Exception ex)
208 throw new IllegalStateException(ex.toString());
212 public java.lang.Object newInstance(java.lang.Object parent)
217 desc.setHandler(handler);
218 desc.setMultivalued(true);
219 addFieldDescriptor(desc);
221 // -- validation code for: _colourList
222 fieldValidator = new org.exolab.castor.xml.FieldValidator();
223 fieldValidator.setMinOccurs(0);
226 desc.setValidator(fieldValidator);
234 * Method getAccessMode.
236 * @return the access mode specified for this class.
238 public org.exolab.castor.mapping.AccessMode getAccessMode()
244 * Method getIdentity.
246 * @return the identity field, null if this class has no identity.
248 public org.exolab.castor.mapping.FieldDescriptor getIdentity()
250 return super.getIdentity();
254 * Method getJavaClass.
256 * @return the Java class represented by this descriptor.
258 public java.lang.Class getJavaClass()
260 return jalview.schemabinding.version2.JalviewUserColours.class;
264 * Method getNameSpacePrefix.
266 * @return the namespace prefix to use when marshaling as XML.
268 public java.lang.String getNameSpacePrefix()
274 * Method getNameSpaceURI.
276 * @return the namespace URI used when marshaling and unmarshaling as XML.
278 public java.lang.String getNameSpaceURI()
284 * Method getValidator.
286 * @return a specific validator for the class described by this
289 public org.exolab.castor.xml.TypeValidator getValidator()
297 * @return the XML Name for the Class being described.
299 public java.lang.String getXMLName()
305 * Method isElementDefinition.
307 * @return true if XML schema definition of this Class is that of a global
308 * element or element with anonymous type definition.
310 public boolean isElementDefinition()
312 return _elementDefinition;