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