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.builder.binding.xml.descriptors;
9   
10    //---------------------------------/
11   //- Imported classes and packages -/
12  //---------------------------------/
13  
14  import org.exolab.castor.builder.binding.xml.FieldType;
15  
16  /**
17   * Class FieldTypeDescriptor.
18   * 
19   * @version $Revision$ $Date$
20   */
21  public class FieldTypeDescriptor extends org.exolab.castor.xml.util.XMLClassDescriptorImpl {
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 FieldTypeDescriptor() {
59          super();
60          _nsURI = "http://www.castor.org/SourceGenerator/Binding";
61          _xmlName = "fieldType";
62          _elementDefinition = false;
63          org.exolab.castor.xml.util.XMLFieldDescriptorImpl  desc           = null;
64          org.exolab.castor.mapping.FieldHandler             handler        = null;
65          org.exolab.castor.xml.FieldValidator               fieldValidator = null;
66          //-- initialize attribute descriptors
67  
68          //-- _name
69          desc = new org.exolab.castor.xml.util.XMLFieldDescriptorImpl(java.lang.String.class, "_name", "name", org.exolab.castor.xml.NodeType.Attribute);
70          desc.setImmutable(true);
71          handler = new org.exolab.castor.xml.XMLFieldHandler() {
72              public java.lang.Object getValue( java.lang.Object object ) 
73                  throws IllegalStateException
74              {
75                  FieldType target = (FieldType) object;
76                  return target.getName();
77              }
78              public void setValue( java.lang.Object object, java.lang.Object value) 
79                  throws IllegalStateException, IllegalArgumentException
80              {
81                  try {
82                      FieldType target = (FieldType) object;
83                      target.setName( (java.lang.String) value);
84                  } catch (java.lang.Exception ex) {
85                      throw new IllegalStateException(ex.toString());
86                  }
87              }
88              public java.lang.Object newInstance(java.lang.Object parent) {
89                  return null;
90              }
91          };
92          desc.setSchemaType("string");
93          desc.setHandler(handler);
94          desc.setMultivalued(false);
95          addFieldDescriptor(desc);
96  
97          //-- validation code for: _name
98          fieldValidator = new org.exolab.castor.xml.FieldValidator();
99          { //-- local scope
100             org.exolab.castor.xml.validators.StringValidator typeValidator;
101             typeValidator = new org.exolab.castor.xml.validators.StringValidator();
102             fieldValidator.setValidator(typeValidator);
103             typeValidator.setWhiteSpace("preserve");
104         }
105         desc.setValidator(fieldValidator);
106         //-- _javaType
107         desc = new org.exolab.castor.xml.util.XMLFieldDescriptorImpl(java.lang.String.class, "_javaType", "java-type", org.exolab.castor.xml.NodeType.Attribute);
108         desc.setImmutable(true);
109         handler = new org.exolab.castor.xml.XMLFieldHandler() {
110             public java.lang.Object getValue( java.lang.Object object ) 
111                 throws IllegalStateException
112             {
113                 FieldType target = (FieldType) object;
114                 return target.getJavaType();
115             }
116             public void setValue( java.lang.Object object, java.lang.Object value) 
117                 throws IllegalStateException, IllegalArgumentException
118             {
119                 try {
120                     FieldType target = (FieldType) object;
121                     target.setJavaType( (java.lang.String) value);
122                 } catch (java.lang.Exception ex) {
123                     throw new IllegalStateException(ex.toString());
124                 }
125             }
126             public java.lang.Object newInstance(java.lang.Object parent) {
127                 return null;
128             }
129         };
130         desc.setSchemaType("string");
131         desc.setHandler(handler);
132         desc.setMultivalued(false);
133         addFieldDescriptor(desc);
134 
135         //-- validation code for: _javaType
136         fieldValidator = new org.exolab.castor.xml.FieldValidator();
137         { //-- local scope
138             org.exolab.castor.xml.validators.StringValidator typeValidator;
139             typeValidator = new org.exolab.castor.xml.validators.StringValidator();
140             fieldValidator.setValidator(typeValidator);
141             typeValidator.setWhiteSpace("preserve");
142         }
143         desc.setValidator(fieldValidator);
144         //-- _wrapper
145         desc = new org.exolab.castor.xml.util.XMLFieldDescriptorImpl(java.lang.Boolean.TYPE, "_wrapper", "wrapper", org.exolab.castor.xml.NodeType.Attribute);
146         handler = new org.exolab.castor.xml.XMLFieldHandler() {
147             public java.lang.Object getValue( java.lang.Object object ) 
148                 throws IllegalStateException
149             {
150                 FieldType target = (FieldType) object;
151                 if (!target.hasWrapper()) { return null; }
152                 return (target.getWrapper() ? java.lang.Boolean.TRUE : java.lang.Boolean.FALSE);
153             }
154             public void setValue( java.lang.Object object, java.lang.Object value) 
155                 throws IllegalStateException, IllegalArgumentException
156             {
157                 try {
158                     FieldType target = (FieldType) object;
159                     // if null, use delete method for optional primitives 
160                     if (value == null) {
161                         target.deleteWrapper();
162                         return;
163                     }
164                     target.setWrapper( ((java.lang.Boolean) value).booleanValue());
165                 } catch (java.lang.Exception ex) {
166                     throw new IllegalStateException(ex.toString());
167                 }
168             }
169             public java.lang.Object newInstance(java.lang.Object parent) {
170                 return null;
171             }
172         };
173         desc.setSchemaType("boolean");
174         desc.setHandler(handler);
175         desc.setMultivalued(false);
176         addFieldDescriptor(desc);
177 
178         //-- validation code for: _wrapper
179         fieldValidator = new org.exolab.castor.xml.FieldValidator();
180         { //-- local scope
181             org.exolab.castor.xml.validators.BooleanValidator typeValidator;
182             typeValidator = new org.exolab.castor.xml.validators.BooleanValidator();
183             fieldValidator.setValidator(typeValidator);
184         }
185         desc.setValidator(fieldValidator);
186         //-- _handler
187         desc = new org.exolab.castor.xml.util.XMLFieldDescriptorImpl(java.lang.String.class, "_handler", "handler", org.exolab.castor.xml.NodeType.Attribute);
188         desc.setImmutable(true);
189         handler = new org.exolab.castor.xml.XMLFieldHandler() {
190             public java.lang.Object getValue( java.lang.Object object ) 
191                 throws IllegalStateException
192             {
193                 FieldType target = (FieldType) object;
194                 return target.getHandler();
195             }
196             public void setValue( java.lang.Object object, java.lang.Object value) 
197                 throws IllegalStateException, IllegalArgumentException
198             {
199                 try {
200                     FieldType target = (FieldType) object;
201                     target.setHandler( (java.lang.String) value);
202                 } catch (java.lang.Exception ex) {
203                     throw new IllegalStateException(ex.toString());
204                 }
205             }
206             public java.lang.Object newInstance(java.lang.Object parent) {
207                 return null;
208             }
209         };
210         desc.setSchemaType("string");
211         desc.setHandler(handler);
212         desc.setMultivalued(false);
213         addFieldDescriptor(desc);
214 
215         //-- validation code for: _handler
216         fieldValidator = new org.exolab.castor.xml.FieldValidator();
217         { //-- local scope
218             org.exolab.castor.xml.validators.StringValidator typeValidator;
219             typeValidator = new org.exolab.castor.xml.validators.StringValidator();
220             fieldValidator.setValidator(typeValidator);
221             typeValidator.setWhiteSpace("preserve");
222         }
223         desc.setValidator(fieldValidator);
224         //-- _collection
225         desc = new org.exolab.castor.xml.util.XMLFieldDescriptorImpl(org.exolab.castor.builder.binding.xml.types.FieldTypeCollectionType.class, "_collection", "collection", org.exolab.castor.xml.NodeType.Attribute);
226         handler = new org.exolab.castor.xml.XMLFieldHandler() {
227             public java.lang.Object getValue( java.lang.Object object ) 
228                 throws IllegalStateException
229             {
230                 FieldType target = (FieldType) object;
231                 return target.getCollection();
232             }
233             public void setValue( java.lang.Object object, java.lang.Object value) 
234                 throws IllegalStateException, IllegalArgumentException
235             {
236                 try {
237                     FieldType target = (FieldType) object;
238                     target.setCollection( (org.exolab.castor.builder.binding.xml.types.FieldTypeCollectionType) value);
239                 } catch (java.lang.Exception ex) {
240                     throw new IllegalStateException(ex.toString());
241                 }
242             }
243             public java.lang.Object newInstance(java.lang.Object parent) {
244                 return null;
245             }
246         };
247         handler = new org.exolab.castor.xml.handlers.EnumFieldHandler(org.exolab.castor.builder.binding.xml.types.FieldTypeCollectionType.class, handler);
248         desc.setImmutable(true);
249         desc.setSchemaType("FieldTypeCollectionType");
250         desc.setHandler(handler);
251         desc.setMultivalued(false);
252         addFieldDescriptor(desc);
253 
254         //-- validation code for: _collection
255         fieldValidator = new org.exolab.castor.xml.FieldValidator();
256         { //-- local scope
257         }
258         desc.setValidator(fieldValidator);
259         //-- _visibility
260         desc = new org.exolab.castor.xml.util.XMLFieldDescriptorImpl(org.exolab.castor.builder.binding.xml.types.FieldTypeVisibilityType.class, "_visibility", "visibility", org.exolab.castor.xml.NodeType.Attribute);
261         handler = new org.exolab.castor.xml.XMLFieldHandler() {
262             public java.lang.Object getValue( java.lang.Object object ) 
263                 throws IllegalStateException
264             {
265                 FieldType target = (FieldType) object;
266                 return target.getVisibility();
267             }
268             public void setValue( java.lang.Object object, java.lang.Object value) 
269                 throws IllegalStateException, IllegalArgumentException
270             {
271                 try {
272                     FieldType target = (FieldType) object;
273                     target.setVisibility( (org.exolab.castor.builder.binding.xml.types.FieldTypeVisibilityType) value);
274                 } catch (java.lang.Exception ex) {
275                     throw new IllegalStateException(ex.toString());
276                 }
277             }
278             public java.lang.Object newInstance(java.lang.Object parent) {
279                 return null;
280             }
281         };
282         handler = new org.exolab.castor.xml.handlers.EnumFieldHandler(org.exolab.castor.builder.binding.xml.types.FieldTypeVisibilityType.class, handler);
283         desc.setImmutable(true);
284         desc.setSchemaType("FieldTypeVisibilityType");
285         desc.setHandler(handler);
286         desc.setMultivalued(false);
287         addFieldDescriptor(desc);
288 
289         //-- validation code for: _visibility
290         fieldValidator = new org.exolab.castor.xml.FieldValidator();
291         { //-- local scope
292         }
293         desc.setValidator(fieldValidator);
294         //-- _validator
295         desc = new org.exolab.castor.xml.util.XMLFieldDescriptorImpl(java.lang.String.class, "_validator", "validator", org.exolab.castor.xml.NodeType.Attribute);
296         desc.setImmutable(true);
297         handler = new org.exolab.castor.xml.XMLFieldHandler() {
298             public java.lang.Object getValue( java.lang.Object object ) 
299                 throws IllegalStateException
300             {
301                 FieldType target = (FieldType) object;
302                 return target.getValidator();
303             }
304             public void setValue( java.lang.Object object, java.lang.Object value) 
305                 throws IllegalStateException, IllegalArgumentException
306             {
307                 try {
308                     FieldType target = (FieldType) object;
309                     target.setValidator( (java.lang.String) value);
310                 } catch (java.lang.Exception ex) {
311                     throw new IllegalStateException(ex.toString());
312                 }
313             }
314             public java.lang.Object newInstance(java.lang.Object parent) {
315                 return null;
316             }
317         };
318         desc.setSchemaType("string");
319         desc.setHandler(handler);
320         desc.setMultivalued(false);
321         addFieldDescriptor(desc);
322 
323         //-- validation code for: _validator
324         fieldValidator = new org.exolab.castor.xml.FieldValidator();
325         { //-- local scope
326             org.exolab.castor.xml.validators.StringValidator typeValidator;
327             typeValidator = new org.exolab.castor.xml.validators.StringValidator();
328             fieldValidator.setValidator(typeValidator);
329             typeValidator.setWhiteSpace("preserve");
330         }
331         desc.setValidator(fieldValidator);
332         //-- initialize element descriptors
333 
334     }
335 
336 
337       //-----------/
338      //- Methods -/
339     //-----------/
340 
341     /**
342      * Method getAccessMode.
343      * 
344      * @return the access mode specified for this class.
345      */
346     public org.exolab.castor.mapping.AccessMode getAccessMode(
347     ) {
348         return null;
349     }
350 
351     /**
352      * Method getIdentity.
353      * 
354      * @return the identity field, null if this class has no
355      * identity.
356      */
357     public org.exolab.castor.mapping.FieldDescriptor getIdentity(
358     ) {
359         return _identity;
360     }
361 
362     /**
363      * Method getJavaClass.
364      * 
365      * @return the Java class represented by this descriptor.
366      */
367     public java.lang.Class getJavaClass(
368     ) {
369         return org.exolab.castor.builder.binding.xml.FieldType.class;
370     }
371 
372     /**
373      * Method getNameSpacePrefix.
374      * 
375      * @return the namespace prefix to use when marshaling as XML.
376      */
377     public java.lang.String getNameSpacePrefix(
378     ) {
379         return _nsPrefix;
380     }
381 
382     /**
383      * Method getNameSpaceURI.
384      * 
385      * @return the namespace URI used when marshaling and
386      * unmarshaling as XML.
387      */
388     public java.lang.String getNameSpaceURI(
389     ) {
390         return _nsURI;
391     }
392 
393     /**
394      * Method getValidator.
395      * 
396      * @return a specific validator for the class described by this
397      * ClassDescriptor.
398      */
399     public org.exolab.castor.xml.TypeValidator getValidator(
400     ) {
401         return this;
402     }
403 
404     /**
405      * Method getXMLName.
406      * 
407      * @return the XML Name for the Class being described.
408      */
409     public java.lang.String getXMLName(
410     ) {
411         return _xmlName;
412     }
413 
414     /**
415      * Method isElementDefinition.
416      * 
417      * @return true if XML schema definition of this Class is that
418      * of a global
419      * element or element with anonymous type definition.
420      */
421     public boolean isElementDefinition(
422     ) {
423         return _elementDefinition;
424     }
425 
426 }