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.ReadonlyDirtyType;
15  
16  /**
17   * Class ReadonlyDirtyTypeDescriptor.
18   * 
19   * @version $Revision$ $Date$
20   */
21  public class ReadonlyDirtyTypeDescriptor 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 ReadonlyDirtyTypeDescriptor() {
59          super();
60          _nsURI = "http://www.castor.org/binding/persistence";
61          _xmlName = "readonlyDirtyType";
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          //-- _readOnly
69          desc = new org.exolab.castor.xml.util.XMLFieldDescriptorImpl(java.lang.Boolean.TYPE, "_readOnly", "read-only", org.exolab.castor.xml.NodeType.Attribute);
70          handler = new org.exolab.castor.xml.XMLFieldHandler() {
71              @Override
72              public java.lang.Object getValue( java.lang.Object object ) 
73                  throws IllegalStateException
74              {
75                  ReadonlyDirtyType target = (ReadonlyDirtyType) object;
76                  if (!target.hasReadOnly()) { return null; }
77                  return (target.getReadOnly() ? java.lang.Boolean.TRUE : java.lang.Boolean.FALSE);
78              }
79              @Override
80              public void setValue( java.lang.Object object, java.lang.Object value) 
81                  throws IllegalStateException, IllegalArgumentException
82              {
83                  try {
84                      ReadonlyDirtyType target = (ReadonlyDirtyType) object;
85                      // if null, use delete method for optional primitives 
86                      if (value == null) {
87                          target.deleteReadOnly();
88                          return;
89                      }
90                      target.setReadOnly( ((java.lang.Boolean) value).booleanValue());
91                  } catch (java.lang.Exception ex) {
92                      throw new IllegalStateException(ex.toString());
93                  }
94              }
95              @Override
96              @SuppressWarnings("unused")
97              public java.lang.Object newInstance(java.lang.Object parent) {
98                  return null;
99              }
100         };
101         desc.setSchemaType("boolean");
102         desc.setHandler(handler);
103         desc.setMultivalued(false);
104         addFieldDescriptor(desc);
105 
106         //-- validation code for: _readOnly
107         fieldValidator = new org.exolab.castor.xml.FieldValidator();
108         { //-- local scope
109             org.exolab.castor.xml.validators.BooleanValidator typeValidator;
110             typeValidator = new org.exolab.castor.xml.validators.BooleanValidator();
111             fieldValidator.setValidator(typeValidator);
112         }
113         desc.setValidator(fieldValidator);
114         //-- _dirty
115         desc = new org.exolab.castor.xml.util.XMLFieldDescriptorImpl(java.lang.Boolean.TYPE, "_dirty", "dirty", org.exolab.castor.xml.NodeType.Attribute);
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                 ReadonlyDirtyType target = (ReadonlyDirtyType) object;
122                 if (!target.hasDirty()) { return null; }
123                 return (target.getDirty() ? java.lang.Boolean.TRUE : java.lang.Boolean.FALSE);
124             }
125             @Override
126             public void setValue( java.lang.Object object, java.lang.Object value) 
127                 throws IllegalStateException, IllegalArgumentException
128             {
129                 try {
130                     ReadonlyDirtyType target = (ReadonlyDirtyType) object;
131                     // if null, use delete method for optional primitives 
132                     if (value == null) {
133                         target.deleteDirty();
134                         return;
135                     }
136                     target.setDirty( ((java.lang.Boolean) value).booleanValue());
137                 } catch (java.lang.Exception ex) {
138                     throw new IllegalStateException(ex.toString());
139                 }
140             }
141             @Override
142             @SuppressWarnings("unused")
143             public java.lang.Object newInstance(java.lang.Object parent) {
144                 return null;
145             }
146         };
147         desc.setSchemaType("boolean");
148         desc.setHandler(handler);
149         desc.setMultivalued(false);
150         addFieldDescriptor(desc);
151 
152         //-- validation code for: _dirty
153         fieldValidator = new org.exolab.castor.xml.FieldValidator();
154         { //-- local scope
155             org.exolab.castor.xml.validators.BooleanValidator typeValidator;
156             typeValidator = new org.exolab.castor.xml.validators.BooleanValidator();
157             fieldValidator.setValidator(typeValidator);
158         }
159         desc.setValidator(fieldValidator);
160         //-- initialize element descriptors
161 
162     }
163 
164 
165       //-----------/
166      //- Methods -/
167     //-----------/
168 
169     /**
170      * Method getAccessMode.
171      * 
172      * @return the access mode specified for this class.
173      */
174     @Override()
175     public org.exolab.castor.mapping.AccessMode getAccessMode(
176     ) {
177         return null;
178     }
179 
180     /**
181      * Method getIdentity.
182      * 
183      * @return the identity field, null if this class has no
184      * identity.
185      */
186     @Override()
187     public org.exolab.castor.mapping.FieldDescriptor getIdentity(
188     ) {
189         return _identity;
190     }
191 
192     /**
193      * Method getJavaClass.
194      * 
195      * @return the Java class represented by this descriptor.
196      */
197     @Override()
198     public java.lang.Class getJavaClass(
199     ) {
200         return org.exolab.castor.xml.schema.annotations.jdo.ReadonlyDirtyType.class;
201     }
202 
203     /**
204      * Method getNameSpacePrefix.
205      * 
206      * @return the namespace prefix to use when marshaling as XML.
207      */
208     @Override()
209     public java.lang.String getNameSpacePrefix(
210     ) {
211         return _nsPrefix;
212     }
213 
214     /**
215      * Method getNameSpaceURI.
216      * 
217      * @return the namespace URI used when marshaling and
218      * unmarshaling as XML.
219      */
220     @Override()
221     public java.lang.String getNameSpaceURI(
222     ) {
223         return _nsURI;
224     }
225 
226     /**
227      * Method getValidator.
228      * 
229      * @return a specific validator for the class described by this
230      * ClassDescriptor.
231      */
232     @Override()
233     public org.exolab.castor.xml.TypeValidator getValidator(
234     ) {
235         return this;
236     }
237 
238     /**
239      * Method getXMLName.
240      * 
241      * @return the XML Name for the Class being described.
242      */
243     @Override()
244     public java.lang.String getXMLName(
245     ) {
246         return _xmlName;
247     }
248 
249     /**
250      * Method isElementDefinition.
251      * 
252      * @return true if XML schema definition of this Class is that
253      * of a global
254      * element or element with anonymous type definition.
255      */
256     public boolean isElementDefinition(
257     ) {
258         return _elementDefinition;
259     }
260 
261 }