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