View Javadoc
1   /*
2    * This class was automatically generated with 
3    * <a href="http://www.castor.org">Castor 1.3.1</a>, using an XML
4    * Schema.
5    * $Id$
6    */
7   
8   package org.exolab.castor.tests.framework.testDescriptor.descriptors;
9   
10    //---------------------------------/
11   //- Imported classes and packages -/
12  //---------------------------------/
13  
14  import org.exolab.castor.tests.framework.testDescriptor.RootType;
15  
16  /**
17   * Class RootTypeDescriptor.
18   * 
19   * @version $Revision$ $Date$
20   */
21  public class RootTypeDescriptor extends org.exolab.castor.tests.framework.testDescriptor.descriptors.StringTypeDescriptor {
22  
23  
24        //--------------------------/
25       //- Class/Member Variables -/
26      //--------------------------/
27  
28      /**
29       * Field _elementDefinition.
30       */
31      private boolean _elementDefinition;
32  
33      /**
34       * Field _nsPrefix.
35       */
36      private java.lang.String _nsPrefix;
37  
38      /**
39       * Field _nsURI.
40       */
41      private java.lang.String _nsURI;
42  
43      /**
44       * Field _xmlName.
45       */
46      private java.lang.String _xmlName;
47  
48      /**
49       * Field _identity.
50       */
51      private org.exolab.castor.xml.XMLFieldDescriptor _identity;
52  
53  
54        //----------------/
55       //- Constructors -/
56      //----------------/
57  
58      public RootTypeDescriptor() {
59          super();
60          setExtendsWithoutFlatten(new org.exolab.castor.tests.framework.testDescriptor.descriptors.StringTypeDescriptor());
61          _nsURI = "http://castor.exolab.org/Test";
62          _xmlName = "RootType";
63          _elementDefinition = false;
64          org.exolab.castor.xml.util.XMLFieldDescriptorImpl  desc           = null;
65          org.exolab.castor.mapping.FieldHandler             handler        = null;
66          org.exolab.castor.xml.FieldValidator               fieldValidator = null;
67          //-- _content
68          desc = new org.exolab.castor.xml.util.XMLFieldDescriptorImpl(java.lang.String.class, "_content", "PCDATA", org.exolab.castor.xml.NodeType.Text);
69          desc.setImmutable(true);
70          handler = new org.exolab.castor.xml.XMLFieldHandler() {
71              public java.lang.Object getValue( java.lang.Object object ) 
72                  throws IllegalStateException
73              {
74                  RootType target = (RootType) object;
75                  return target.getContent();
76              }
77              public void setValue( java.lang.Object object, java.lang.Object value) 
78                  throws IllegalStateException, IllegalArgumentException
79              {
80                  try {
81                      RootType target = (RootType) object;
82                      target.setContent( (java.lang.String) value);
83                  } catch (java.lang.Exception ex) {
84                      throw new IllegalStateException(ex.toString());
85                  }
86              }
87              public java.lang.Object newInstance(java.lang.Object parent) {
88                  return null;
89              }
90          };
91          desc.setSchemaType("string");
92          desc.setHandler(handler);
93          addFieldDescriptor(desc);
94  
95          //-- validation code for: _content
96          fieldValidator = new org.exolab.castor.xml.FieldValidator();
97          { //-- local scope
98              org.exolab.castor.xml.validators.StringValidator typeValidator;
99              typeValidator = new org.exolab.castor.xml.validators.StringValidator();
100             fieldValidator.setValidator(typeValidator);
101             typeValidator.setWhiteSpace("preserve");
102         }
103         desc.setValidator(fieldValidator);
104         //-- initialize attribute descriptors
105 
106         //-- _random
107         desc = new org.exolab.castor.xml.util.XMLFieldDescriptorImpl(java.lang.Boolean.TYPE, "_random", "random", org.exolab.castor.xml.NodeType.Attribute);
108         handler = new org.exolab.castor.xml.XMLFieldHandler() {
109             public java.lang.Object getValue( java.lang.Object object ) 
110                 throws IllegalStateException
111             {
112                 RootType target = (RootType) object;
113                 if (!target.hasRandom()) { return null; }
114                 return (target.getRandom() ? java.lang.Boolean.TRUE : java.lang.Boolean.FALSE);
115             }
116             public void setValue( java.lang.Object object, java.lang.Object value) 
117                 throws IllegalStateException, IllegalArgumentException
118             {
119                 try {
120                     RootType target = (RootType) object;
121                     // if null, use delete method for optional primitives 
122                     if (value == null) {
123                         target.deleteRandom();
124                         return;
125                     }
126                     target.setRandom( ((java.lang.Boolean) value).booleanValue());
127                 } catch (java.lang.Exception ex) {
128                     throw new IllegalStateException(ex.toString());
129                 }
130             }
131             public java.lang.Object newInstance(java.lang.Object parent) {
132                 return null;
133             }
134         };
135         desc.setSchemaType("boolean");
136         desc.setHandler(handler);
137         desc.setMultivalued(false);
138         addFieldDescriptor(desc);
139 
140         //-- validation code for: _random
141         fieldValidator = new org.exolab.castor.xml.FieldValidator();
142         { //-- local scope
143             org.exolab.castor.xml.validators.BooleanValidator typeValidator;
144             typeValidator = new org.exolab.castor.xml.validators.BooleanValidator();
145             fieldValidator.setValidator(typeValidator);
146         }
147         desc.setValidator(fieldValidator);
148         //-- _dump
149         desc = new org.exolab.castor.xml.util.XMLFieldDescriptorImpl(java.lang.Boolean.TYPE, "_dump", "dump", org.exolab.castor.xml.NodeType.Attribute);
150         handler = new org.exolab.castor.xml.XMLFieldHandler() {
151             public java.lang.Object getValue( java.lang.Object object ) 
152                 throws IllegalStateException
153             {
154                 RootType target = (RootType) object;
155                 if (!target.hasDump()) { return null; }
156                 return (target.getDump() ? java.lang.Boolean.TRUE : java.lang.Boolean.FALSE);
157             }
158             public void setValue( java.lang.Object object, java.lang.Object value) 
159                 throws IllegalStateException, IllegalArgumentException
160             {
161                 try {
162                     RootType target = (RootType) object;
163                     // if null, use delete method for optional primitives 
164                     if (value == null) {
165                         target.deleteDump();
166                         return;
167                     }
168                     target.setDump( ((java.lang.Boolean) value).booleanValue());
169                 } catch (java.lang.Exception ex) {
170                     throw new IllegalStateException(ex.toString());
171                 }
172             }
173             public java.lang.Object newInstance(java.lang.Object parent) {
174                 return null;
175             }
176         };
177         desc.setSchemaType("boolean");
178         desc.setHandler(handler);
179         desc.setMultivalued(false);
180         addFieldDescriptor(desc);
181 
182         //-- validation code for: _dump
183         fieldValidator = new org.exolab.castor.xml.FieldValidator();
184         { //-- local scope
185             org.exolab.castor.xml.validators.BooleanValidator typeValidator;
186             typeValidator = new org.exolab.castor.xml.validators.BooleanValidator();
187             fieldValidator.setValidator(typeValidator);
188         }
189         desc.setValidator(fieldValidator);
190         //-- initialize element descriptors
191 
192     }
193 
194 
195       //-----------/
196      //- Methods -/
197     //-----------/
198 
199     /**
200      * Method getAccessMode.
201      * 
202      * @return the access mode specified for this class.
203      */
204     public org.exolab.castor.mapping.AccessMode getAccessMode(
205     ) {
206         return null;
207     }
208 
209     /**
210      * Method getIdentity.
211      * 
212      * @return the identity field, null if this class has no
213      * identity.
214      */
215     public org.exolab.castor.mapping.FieldDescriptor getIdentity(
216     ) {
217         if (_identity == null) {
218             return super.getIdentity();
219         }
220         return _identity;
221     }
222 
223     /**
224      * Method getJavaClass.
225      * 
226      * @return the Java class represented by this descriptor.
227      */
228     public java.lang.Class getJavaClass(
229     ) {
230         return org.exolab.castor.tests.framework.testDescriptor.RootType.class;
231     }
232 
233     /**
234      * Method getNameSpacePrefix.
235      * 
236      * @return the namespace prefix to use when marshaling as XML.
237      */
238     public java.lang.String getNameSpacePrefix(
239     ) {
240         return _nsPrefix;
241     }
242 
243     /**
244      * Method getNameSpaceURI.
245      * 
246      * @return the namespace URI used when marshaling and
247      * unmarshaling as XML.
248      */
249     public java.lang.String getNameSpaceURI(
250     ) {
251         return _nsURI;
252     }
253 
254     /**
255      * Method getValidator.
256      * 
257      * @return a specific validator for the class described by this
258      * ClassDescriptor.
259      */
260     public org.exolab.castor.xml.TypeValidator getValidator(
261     ) {
262         return this;
263     }
264 
265     /**
266      * Method getXMLName.
267      * 
268      * @return the XML Name for the Class being described.
269      */
270     public java.lang.String getXMLName(
271     ) {
272         return _xmlName;
273     }
274 
275     /**
276      * Method isElementDefinition.
277      * 
278      * @return true if XML schema definition of this Class is that
279      * of a global
280      * element or element with anonymous type definition.
281      */
282     public boolean isElementDefinition(
283     ) {
284         return _elementDefinition;
285     }
286 
287 }