Jalview 2.6 source licence
[jalview.git] / src / jalview / schemabinding / version2 / descriptors / PdbidsDescriptor.java
1 /*\r
2  * Jalview - A Sequence Alignment Editor and Viewer (Version 2.6)\r
3  * Copyright (C) 2010 J Procter, AM Waterhouse, G Barton, M Clamp, S Searle\r
4  * \r
5  * This file is part of Jalview.\r
6  * \r
7  * Jalview is free software: you can redistribute it and/or\r
8  * modify it under the terms of the GNU General Public License \r
9  * as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version.\r
10  * \r
11  * Jalview is distributed in the hope that it will be useful, but \r
12  * WITHOUT ANY WARRANTY; without even the implied warranty \r
13  * of MERCHANTABILITY or FITNESS FOR A PARTICULAR \r
14  * PURPOSE.  See the GNU General Public License for more details.\r
15  * \r
16  * You should have received a copy of the GNU General Public License along with Jalview.  If not, see <http://www.gnu.org/licenses/>.\r
17  */\r
18 package jalview.schemabinding.version2.descriptors;\r
19 \r
20 //---------------------------------/\r
21 //- Imported classes and packages -/\r
22 //---------------------------------/\r
23 \r
24 import jalview.schemabinding.version2.Pdbids;\r
25 \r
26 /**\r
27  * Class PdbidsDescriptor.\r
28  * \r
29  * @version $Revision$ $Date$\r
30  */\r
31 public class PdbidsDescriptor extends\r
32         jalview.schemabinding.version2.descriptors.PdbentryDescriptor\r
33 {\r
34 \r
35   // --------------------------/\r
36   // - Class/Member Variables -/\r
37   // --------------------------/\r
38 \r
39   /**\r
40    * Field _elementDefinition.\r
41    */\r
42   private boolean _elementDefinition;\r
43 \r
44   /**\r
45    * Field _nsPrefix.\r
46    */\r
47   private java.lang.String _nsPrefix;\r
48 \r
49   /**\r
50    * Field _nsURI.\r
51    */\r
52   private java.lang.String _nsURI;\r
53 \r
54   /**\r
55    * Field _xmlName.\r
56    */\r
57   private java.lang.String _xmlName;\r
58 \r
59   // ----------------/\r
60   // - Constructors -/\r
61   // ----------------/\r
62 \r
63   public PdbidsDescriptor()\r
64   {\r
65     super();\r
66     setExtendsWithoutFlatten(new jalview.schemabinding.version2.descriptors.PdbentryDescriptor());\r
67     _nsURI = "www.jalview.org";\r
68     _xmlName = "pdbids";\r
69     _elementDefinition = true;\r
70 \r
71     // -- set grouping compositor\r
72     setCompositorAsSequence();\r
73     org.exolab.castor.xml.util.XMLFieldDescriptorImpl desc = null;\r
74     org.exolab.castor.mapping.FieldHandler handler = null;\r
75     org.exolab.castor.xml.FieldValidator fieldValidator = null;\r
76     // -- initialize attribute descriptors\r
77 \r
78     // -- initialize element descriptors\r
79 \r
80     // -- _structureStateList\r
81     desc = new org.exolab.castor.xml.util.XMLFieldDescriptorImpl(\r
82             jalview.schemabinding.version2.StructureState.class,\r
83             "_structureStateList", "structureState",\r
84             org.exolab.castor.xml.NodeType.Element);\r
85     handler = new org.exolab.castor.xml.XMLFieldHandler()\r
86     {\r
87       public java.lang.Object getValue(java.lang.Object object)\r
88               throws IllegalStateException\r
89       {\r
90         Pdbids target = (Pdbids) object;\r
91         return target.getStructureState();\r
92       }\r
93 \r
94       public void setValue(java.lang.Object object, java.lang.Object value)\r
95               throws IllegalStateException, IllegalArgumentException\r
96       {\r
97         try\r
98         {\r
99           Pdbids target = (Pdbids) object;\r
100           target\r
101                   .addStructureState((jalview.schemabinding.version2.StructureState) value);\r
102         } catch (java.lang.Exception ex)\r
103         {\r
104           throw new IllegalStateException(ex.toString());\r
105         }\r
106       }\r
107 \r
108       public void resetValue(Object object) throws IllegalStateException,\r
109               IllegalArgumentException\r
110       {\r
111         try\r
112         {\r
113           Pdbids target = (Pdbids) object;\r
114           target.removeAllStructureState();\r
115         } catch (java.lang.Exception ex)\r
116         {\r
117           throw new IllegalStateException(ex.toString());\r
118         }\r
119       }\r
120 \r
121       public java.lang.Object newInstance(java.lang.Object parent)\r
122       {\r
123         return new jalview.schemabinding.version2.StructureState();\r
124       }\r
125     };\r
126     desc.setHandler(handler);\r
127     desc.setNameSpaceURI("www.jalview.org");\r
128     desc.setMultivalued(true);\r
129     addFieldDescriptor(desc);\r
130 \r
131     // -- validation code for: _structureStateList\r
132     fieldValidator = new org.exolab.castor.xml.FieldValidator();\r
133     fieldValidator.setMinOccurs(0);\r
134     { // -- local scope\r
135     }\r
136     desc.setValidator(fieldValidator);\r
137   }\r
138 \r
139   // -----------/\r
140   // - Methods -/\r
141   // -----------/\r
142 \r
143   /**\r
144    * Method getAccessMode.\r
145    * \r
146    * @return the access mode specified for this class.\r
147    */\r
148   public org.exolab.castor.mapping.AccessMode getAccessMode()\r
149   {\r
150     return null;\r
151   }\r
152 \r
153   /**\r
154    * Method getIdentity.\r
155    * \r
156    * @return the identity field, null if this class has no identity.\r
157    */\r
158   public org.exolab.castor.mapping.FieldDescriptor getIdentity()\r
159   {\r
160     return super.getIdentity();\r
161   }\r
162 \r
163   /**\r
164    * Method getJavaClass.\r
165    * \r
166    * @return the Java class represented by this descriptor.\r
167    */\r
168   public java.lang.Class getJavaClass()\r
169   {\r
170     return jalview.schemabinding.version2.Pdbids.class;\r
171   }\r
172 \r
173   /**\r
174    * Method getNameSpacePrefix.\r
175    * \r
176    * @return the namespace prefix to use when marshaling as XML.\r
177    */\r
178   public java.lang.String getNameSpacePrefix()\r
179   {\r
180     return _nsPrefix;\r
181   }\r
182 \r
183   /**\r
184    * Method getNameSpaceURI.\r
185    * \r
186    * @return the namespace URI used when marshaling and unmarshaling as XML.\r
187    */\r
188   public java.lang.String getNameSpaceURI()\r
189   {\r
190     return _nsURI;\r
191   }\r
192 \r
193   /**\r
194    * Method getValidator.\r
195    * \r
196    * @return a specific validator for the class described by this\r
197    *         ClassDescriptor.\r
198    */\r
199   public org.exolab.castor.xml.TypeValidator getValidator()\r
200   {\r
201     return this;\r
202   }\r
203 \r
204   /**\r
205    * Method getXMLName.\r
206    * \r
207    * @return the XML Name for the Class being described.\r
208    */\r
209   public java.lang.String getXMLName()\r
210   {\r
211     return _xmlName;\r
212   }\r
213 \r
214   /**\r
215    * Method isElementDefinition.\r
216    * \r
217    * @return true if XML schema definition of this Class is that of a global\r
218    *         element or element with anonymous type definition.\r
219    */\r
220   public boolean isElementDefinition()\r
221   {\r
222     return _elementDefinition;\r
223   }\r
224 \r
225 }\r