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.UserColours;
28 * Class UserColoursDescriptor.
30 * @version $Revision$ $Date$
32 public class UserColoursDescriptor 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 UserColoursDescriptor()
67 _nsURI = "www.jalview.org";
68 _xmlName = "UserColours";
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
79 desc = new org.exolab.castor.xml.util.XMLFieldDescriptorImpl(
80 java.lang.String.class, "_id", "id",
81 org.exolab.castor.xml.NodeType.Attribute);
82 desc.setImmutable(true);
83 handler = new org.exolab.castor.xml.XMLFieldHandler()
85 public java.lang.Object getValue(java.lang.Object object)
86 throws IllegalStateException
88 UserColours target = (UserColours) object;
89 return target.getId();
92 public void setValue(java.lang.Object object, java.lang.Object value)
93 throws IllegalStateException, IllegalArgumentException
97 UserColours target = (UserColours) object;
98 target.setId((java.lang.String) value);
99 } catch (java.lang.Exception ex)
101 throw new IllegalStateException(ex.toString());
105 public java.lang.Object newInstance(java.lang.Object parent)
110 desc.setHandler(handler);
111 desc.setMultivalued(false);
112 addFieldDescriptor(desc);
114 // -- validation code for: _id
115 fieldValidator = new org.exolab.castor.xml.FieldValidator();
117 org.exolab.castor.xml.validators.StringValidator typeValidator;
118 typeValidator = new org.exolab.castor.xml.validators.StringValidator();
119 fieldValidator.setValidator(typeValidator);
120 typeValidator.setWhiteSpace("preserve");
122 desc.setValidator(fieldValidator);
123 // -- initialize element descriptors
125 // -- _userColourScheme
126 desc = new org.exolab.castor.xml.util.XMLFieldDescriptorImpl(
127 jalview.schemabinding.version2.UserColourScheme.class,
128 "_userColourScheme", "UserColourScheme",
129 org.exolab.castor.xml.NodeType.Element);
130 handler = new org.exolab.castor.xml.XMLFieldHandler()
132 public java.lang.Object getValue(java.lang.Object object)
133 throws IllegalStateException
135 UserColours target = (UserColours) object;
136 return target.getUserColourScheme();
139 public void setValue(java.lang.Object object, java.lang.Object value)
140 throws IllegalStateException, IllegalArgumentException
144 UserColours target = (UserColours) object;
145 target.setUserColourScheme((jalview.schemabinding.version2.UserColourScheme) value);
146 } catch (java.lang.Exception ex)
148 throw new IllegalStateException(ex.toString());
152 public java.lang.Object newInstance(java.lang.Object parent)
154 return new jalview.schemabinding.version2.UserColourScheme();
157 desc.setHandler(handler);
158 desc.setNameSpaceURI("www.jalview.org");
159 desc.setRequired(true);
160 desc.setMultivalued(false);
161 addFieldDescriptor(desc);
163 // -- validation code for: _userColourScheme
164 fieldValidator = new org.exolab.castor.xml.FieldValidator();
165 fieldValidator.setMinOccurs(1);
168 desc.setValidator(fieldValidator);
176 * Method getAccessMode.
178 * @return the access mode specified for this class.
180 public org.exolab.castor.mapping.AccessMode getAccessMode()
186 * Method getIdentity.
188 * @return the identity field, null if this class has no identity.
190 public org.exolab.castor.mapping.FieldDescriptor getIdentity()
192 return super.getIdentity();
196 * Method getJavaClass.
198 * @return the Java class represented by this descriptor.
200 public java.lang.Class getJavaClass()
202 return jalview.schemabinding.version2.UserColours.class;
206 * Method getNameSpacePrefix.
208 * @return the namespace prefix to use when marshaling as XML.
210 public java.lang.String getNameSpacePrefix()
216 * Method getNameSpaceURI.
218 * @return the namespace URI used when marshaling and unmarshaling as XML.
220 public java.lang.String getNameSpaceURI()
226 * Method getValidator.
228 * @return a specific validator for the class described by this
231 public org.exolab.castor.xml.TypeValidator getValidator()
239 * @return the XML Name for the Class being described.
241 public java.lang.String getXMLName()
247 * Method isElementDefinition.
249 * @return true if XML schema definition of this Class is that of a global
250 * element or element with anonymous type definition.
252 public boolean isElementDefinition()
254 return _elementDefinition;