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