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.xml.schema.annotations.jdo.descriptors;
9   
10    //---------------------------------/
11   //- Imported classes and packages -/
12  //---------------------------------/
13  
14  import org.exolab.castor.xml.schema.annotations.jdo.Table;
15  
16  /**
17   * Class TableDescriptor.
18   * 
19   * @version $Revision$ $Date$
20   */
21  public class TableDescriptor 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 TableDescriptor() {
59          super();
60          _nsURI = "http://www.castor.org/binding/persistence";
61          _xmlName = "table";
62          _elementDefinition = true;
63  
64          //-- set grouping compositor
65          setCompositorAsSequence();
66          org.exolab.castor.xml.util.XMLFieldDescriptorImpl  desc           = null;
67          org.exolab.castor.mapping.FieldHandler             handler        = null;
68          org.exolab.castor.xml.FieldValidator               fieldValidator = null;
69          //-- initialize attribute descriptors
70  
71          //-- _name
72          desc = new org.exolab.castor.xml.util.XMLFieldDescriptorImpl(java.lang.String.class, "_name", "name", org.exolab.castor.xml.NodeType.Attribute);
73          desc.setImmutable(true);
74          handler = new org.exolab.castor.xml.XMLFieldHandler() {
75              @Override
76              public java.lang.Object getValue( java.lang.Object object ) 
77                  throws IllegalStateException
78              {
79                  Table target = (Table) object;
80                  return target.getName();
81              }
82              @Override
83              public void setValue( java.lang.Object object, java.lang.Object value) 
84                  throws IllegalStateException, IllegalArgumentException
85              {
86                  try {
87                      Table target = (Table) object;
88                      target.setName( (java.lang.String) value);
89                  } catch (java.lang.Exception ex) {
90                      throw new IllegalStateException(ex.toString());
91                  }
92              }
93              @Override
94              @SuppressWarnings("unused")
95              public java.lang.Object newInstance(java.lang.Object parent) {
96                  return null;
97              }
98          };
99          desc.setSchemaType("string");
100         desc.setHandler(handler);
101         desc.setRequired(true);
102         desc.setMultivalued(false);
103         addFieldDescriptor(desc);
104 
105         //-- validation code for: _name
106         fieldValidator = new org.exolab.castor.xml.FieldValidator();
107         fieldValidator.setMinOccurs(1);
108         { //-- local scope
109             org.exolab.castor.xml.validators.StringValidator typeValidator;
110             typeValidator = new org.exolab.castor.xml.validators.StringValidator();
111             fieldValidator.setValidator(typeValidator);
112             typeValidator.setWhiteSpace("preserve");
113         }
114         desc.setValidator(fieldValidator);
115         //-- _accessMode
116         desc = new org.exolab.castor.xml.util.XMLFieldDescriptorImpl(types.TableAccessModeType.class, "_accessMode", "accessMode", org.exolab.castor.xml.NodeType.Attribute);
117         handler = new org.exolab.castor.xml.XMLFieldHandler() {
118             @Override
119             public java.lang.Object getValue( java.lang.Object object ) 
120                 throws IllegalStateException
121             {
122                 Table target = (Table) object;
123                 return target.getAccessMode();
124             }
125             @Override
126             public void setValue( java.lang.Object object, java.lang.Object value) 
127                 throws IllegalStateException, IllegalArgumentException
128             {
129                 try {
130                     Table target = (Table) object;
131                     target.setAccessMode( (types.TableAccessModeType) value);
132                 } catch (java.lang.Exception ex) {
133                     throw new IllegalStateException(ex.toString());
134                 }
135             }
136             @Override
137             @SuppressWarnings("unused")
138             public java.lang.Object newInstance(java.lang.Object parent) {
139                 return null;
140             }
141         };
142         handler = new org.exolab.castor.xml.handlers.EnumFieldHandler(types.TableAccessModeType.class, handler);
143         desc.setImmutable(true);
144         desc.setSchemaType("TableAccessModeType");
145         desc.setHandler(handler);
146         desc.setMultivalued(false);
147         addFieldDescriptor(desc);
148 
149         //-- validation code for: _accessMode
150         fieldValidator = new org.exolab.castor.xml.FieldValidator();
151         { //-- local scope
152         }
153         desc.setValidator(fieldValidator);
154         //-- _detachable
155         desc = new org.exolab.castor.xml.util.XMLFieldDescriptorImpl(java.lang.Boolean.TYPE, "_detachable", "detachable", org.exolab.castor.xml.NodeType.Attribute);
156         handler = new org.exolab.castor.xml.XMLFieldHandler() {
157             @Override
158             public java.lang.Object getValue( java.lang.Object object ) 
159                 throws IllegalStateException
160             {
161                 Table target = (Table) object;
162                 if (!target.hasDetachable()) { return null; }
163                 return (target.getDetachable() ? java.lang.Boolean.TRUE : java.lang.Boolean.FALSE);
164             }
165             @Override
166             public void setValue( java.lang.Object object, java.lang.Object value) 
167                 throws IllegalStateException, IllegalArgumentException
168             {
169                 try {
170                     Table target = (Table) object;
171                     // if null, use delete method for optional primitives 
172                     if (value == null) {
173                         target.deleteDetachable();
174                         return;
175                     }
176                     target.setDetachable( ((java.lang.Boolean) value).booleanValue());
177                 } catch (java.lang.Exception ex) {
178                     throw new IllegalStateException(ex.toString());
179                 }
180             }
181             @Override
182             @SuppressWarnings("unused")
183             public java.lang.Object newInstance(java.lang.Object parent) {
184                 return null;
185             }
186         };
187         desc.setSchemaType("boolean");
188         desc.setHandler(handler);
189         desc.setMultivalued(false);
190         addFieldDescriptor(desc);
191 
192         //-- validation code for: _detachable
193         fieldValidator = new org.exolab.castor.xml.FieldValidator();
194         { //-- local scope
195             org.exolab.castor.xml.validators.BooleanValidator typeValidator;
196             typeValidator = new org.exolab.castor.xml.validators.BooleanValidator();
197             fieldValidator.setValidator(typeValidator);
198         }
199         desc.setValidator(fieldValidator);
200         //-- initialize element descriptors
201 
202         //-- _primaryKey
203         desc = new org.exolab.castor.xml.util.XMLFieldDescriptorImpl(org.exolab.castor.xml.schema.annotations.jdo.PrimaryKey.class, "_primaryKey", "primaryKey", org.exolab.castor.xml.NodeType.Element);
204         handler = new org.exolab.castor.xml.XMLFieldHandler() {
205             @Override
206             public java.lang.Object getValue( java.lang.Object object ) 
207                 throws IllegalStateException
208             {
209                 Table target = (Table) object;
210                 return target.getPrimaryKey();
211             }
212             @Override
213             public void setValue( java.lang.Object object, java.lang.Object value) 
214                 throws IllegalStateException, IllegalArgumentException
215             {
216                 try {
217                     Table target = (Table) object;
218                     target.setPrimaryKey( (org.exolab.castor.xml.schema.annotations.jdo.PrimaryKey) value);
219                 } catch (java.lang.Exception ex) {
220                     throw new IllegalStateException(ex.toString());
221                 }
222             }
223             @Override
224             @SuppressWarnings("unused")
225             public java.lang.Object newInstance(java.lang.Object parent) {
226                 return new org.exolab.castor.xml.schema.annotations.jdo.PrimaryKey();
227             }
228         };
229         desc.setSchemaType("org.exolab.castor.xml.schema.annotations.jdo.PrimaryKey");
230         desc.setHandler(handler);
231         desc.setNameSpaceURI("http://www.castor.org/binding/persistence");
232         desc.setRequired(true);
233         desc.setMultivalued(false);
234         addFieldDescriptor(desc);
235         addSequenceElement(desc);
236 
237         //-- validation code for: _primaryKey
238         fieldValidator = new org.exolab.castor.xml.FieldValidator();
239         fieldValidator.setMinOccurs(1);
240         { //-- local scope
241         }
242         desc.setValidator(fieldValidator);
243     }
244 
245 
246       //-----------/
247      //- Methods -/
248     //-----------/
249 
250     /**
251      * Method getAccessMode.
252      * 
253      * @return the access mode specified for this class.
254      */
255     @Override()
256     public org.exolab.castor.mapping.AccessMode getAccessMode(
257     ) {
258         return null;
259     }
260 
261     /**
262      * Method getIdentity.
263      * 
264      * @return the identity field, null if this class has no
265      * identity.
266      */
267     @Override()
268     public org.exolab.castor.mapping.FieldDescriptor getIdentity(
269     ) {
270         return _identity;
271     }
272 
273     /**
274      * Method getJavaClass.
275      * 
276      * @return the Java class represented by this descriptor.
277      */
278     @Override()
279     public java.lang.Class getJavaClass(
280     ) {
281         return org.exolab.castor.xml.schema.annotations.jdo.Table.class;
282     }
283 
284     /**
285      * Method getNameSpacePrefix.
286      * 
287      * @return the namespace prefix to use when marshaling as XML.
288      */
289     @Override()
290     public java.lang.String getNameSpacePrefix(
291     ) {
292         return _nsPrefix;
293     }
294 
295     /**
296      * Method getNameSpaceURI.
297      * 
298      * @return the namespace URI used when marshaling and
299      * unmarshaling as XML.
300      */
301     @Override()
302     public java.lang.String getNameSpaceURI(
303     ) {
304         return _nsURI;
305     }
306 
307     /**
308      * Method getValidator.
309      * 
310      * @return a specific validator for the class described by this
311      * ClassDescriptor.
312      */
313     @Override()
314     public org.exolab.castor.xml.TypeValidator getValidator(
315     ) {
316         return this;
317     }
318 
319     /**
320      * Method getXMLName.
321      * 
322      * @return the XML Name for the Class being described.
323      */
324     @Override()
325     public java.lang.String getXMLName(
326     ) {
327         return _xmlName;
328     }
329 
330     /**
331      * Method isElementDefinition.
332      * 
333      * @return true if XML schema definition of this Class is that
334      * of a global
335      * element or element with anonymous type definition.
336      */
337     public boolean isElementDefinition(
338     ) {
339         return _elementDefinition;
340     }
341 
342 }