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.mapping.xml.descriptors;
9   
10    //---------------------------------/
11   //- Imported classes and packages -/
12  //---------------------------------/
13  
14  import org.exolab.castor.mapping.xml.PropertyType;
15  
16  /**
17   * Class PropertyTypeDescriptor.
18   * 
19   * @version $Revision$ $Date$
20   */
21  public class PropertyTypeDescriptor 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 PropertyTypeDescriptor() {
59          super();
60          _nsURI = "http://castor.exolab.org/";
61          _xmlName = "propertyType";
62          _elementDefinition = false;
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          //-- initialize element descriptors
72  
73          //-- _name
74          desc = new org.exolab.castor.xml.util.XMLFieldDescriptorImpl(java.lang.String.class, "_name", "name", org.exolab.castor.xml.NodeType.Element);
75          desc.setImmutable(true);
76          handler = new org.exolab.castor.xml.XMLFieldHandler() {
77              @Override
78              public java.lang.Object getValue( java.lang.Object object ) 
79                  throws IllegalStateException
80              {
81                  PropertyType target = (PropertyType) object;
82                  return target.getName();
83              }
84              @Override
85              public void setValue( java.lang.Object object, java.lang.Object value) 
86                  throws IllegalStateException, IllegalArgumentException
87              {
88                  try {
89                      PropertyType target = (PropertyType) object;
90                      target.setName( (java.lang.String) value);
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("string");
102         desc.setHandler(handler);
103         desc.setRequired(true);
104         desc.setMultivalued(false);
105         addFieldDescriptor(desc);
106         addSequenceElement(desc);
107 
108         //-- validation code for: _name
109         fieldValidator = new org.exolab.castor.xml.FieldValidator();
110         fieldValidator.setMinOccurs(1);
111         { //-- local scope
112             org.exolab.castor.xml.validators.StringValidator typeValidator;
113             typeValidator = new org.exolab.castor.xml.validators.StringValidator();
114             fieldValidator.setValidator(typeValidator);
115             typeValidator.setWhiteSpace("preserve");
116         }
117         desc.setValidator(fieldValidator);
118         //-- _value
119         desc = new org.exolab.castor.xml.util.XMLFieldDescriptorImpl(java.lang.String.class, "_value", "value", org.exolab.castor.xml.NodeType.Element);
120         desc.setImmutable(true);
121         handler = new org.exolab.castor.xml.XMLFieldHandler() {
122             @Override
123             public java.lang.Object getValue( java.lang.Object object ) 
124                 throws IllegalStateException
125             {
126                 PropertyType target = (PropertyType) object;
127                 return target.getValue();
128             }
129             @Override
130             public void setValue( java.lang.Object object, java.lang.Object value) 
131                 throws IllegalStateException, IllegalArgumentException
132             {
133                 try {
134                     PropertyType target = (PropertyType) object;
135                     target.setValue( (java.lang.String) value);
136                 } catch (java.lang.Exception ex) {
137                     throw new IllegalStateException(ex.toString());
138                 }
139             }
140             @Override
141             @SuppressWarnings("unused")
142             public java.lang.Object newInstance(java.lang.Object parent) {
143                 return null;
144             }
145         };
146         desc.setSchemaType("string");
147         desc.setHandler(handler);
148         desc.setRequired(true);
149         desc.setMultivalued(false);
150         addFieldDescriptor(desc);
151         addSequenceElement(desc);
152 
153         //-- validation code for: _value
154         fieldValidator = new org.exolab.castor.xml.FieldValidator();
155         fieldValidator.setMinOccurs(1);
156         { //-- local scope
157             org.exolab.castor.xml.validators.StringValidator typeValidator;
158             typeValidator = new org.exolab.castor.xml.validators.StringValidator();
159             fieldValidator.setValidator(typeValidator);
160             typeValidator.setWhiteSpace("preserve");
161         }
162         desc.setValidator(fieldValidator);
163     }
164 
165 
166       //-----------/
167      //- Methods -/
168     //-----------/
169 
170     /**
171      * Method getAccessMode.
172      * 
173      * @return the access mode specified for this class.
174      */
175     @Override()
176     public org.exolab.castor.mapping.AccessMode getAccessMode(
177     ) {
178         return null;
179     }
180 
181     /**
182      * Method getIdentity.
183      * 
184      * @return the identity field, null if this class has no
185      * identity.
186      */
187     @Override()
188     public org.exolab.castor.mapping.FieldDescriptor getIdentity(
189     ) {
190         return _identity;
191     }
192 
193     /**
194      * Method getJavaClass.
195      * 
196      * @return the Java class represented by this descriptor.
197      */
198     @Override()
199     public java.lang.Class getJavaClass(
200     ) {
201         return org.exolab.castor.mapping.xml.PropertyType.class;
202     }
203 
204     /**
205      * Method getNameSpacePrefix.
206      * 
207      * @return the namespace prefix to use when marshaling as XML.
208      */
209     @Override()
210     public java.lang.String getNameSpacePrefix(
211     ) {
212         return _nsPrefix;
213     }
214 
215     /**
216      * Method getNameSpaceURI.
217      * 
218      * @return the namespace URI used when marshaling and
219      * unmarshaling as XML.
220      */
221     @Override()
222     public java.lang.String getNameSpaceURI(
223     ) {
224         return _nsURI;
225     }
226 
227     /**
228      * Method getValidator.
229      * 
230      * @return a specific validator for the class described by this
231      * ClassDescriptor.
232      */
233     @Override()
234     public org.exolab.castor.xml.TypeValidator getValidator(
235     ) {
236         return this;
237     }
238 
239     /**
240      * Method getXMLName.
241      * 
242      * @return the XML Name for the Class being described.
243      */
244     @Override()
245     public java.lang.String getXMLName(
246     ) {
247         return _xmlName;
248     }
249 
250     /**
251      * Method isElementDefinition.
252      * 
253      * @return true if XML schema definition of this Class is that
254      * of a global
255      * element or element with anonymous type definition.
256      */
257     public boolean isElementDefinition(
258     ) {
259         return _elementDefinition;
260     }
261 
262 }