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.PkType;
15  
16  /**
17   * Class PkTypeDescriptor.
18   * 
19   * @version $Revision$ $Date$
20   */
21  public class PkTypeDescriptor 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 PkTypeDescriptor() {
59          super();
60          _nsURI = "http://www.castor.org/binding/persistence";
61          _xmlName = "pkType";
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          //-- _keyList
74          desc = new org.exolab.castor.xml.util.XMLFieldDescriptorImpl(java.lang.String.class, "_keyList", "key", 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                  PkType target = (PkType) object;
82                  return target.getKey();
83              }
84              @Override
85              public void setValue( java.lang.Object object, java.lang.Object value) 
86                  throws IllegalStateException, IllegalArgumentException
87              {
88                  try {
89                      PkType target = (PkType) object;
90                      target.addKey( (java.lang.String) value);
91                  } catch (java.lang.Exception ex) {
92                      throw new IllegalStateException(ex.toString());
93                  }
94              }
95              public void resetValue(Object object) throws IllegalStateException, IllegalArgumentException {
96                  try {
97                      PkType target = (PkType) object;
98                      target.removeAllKey();
99                  } catch (java.lang.Exception ex) {
100                     throw new IllegalStateException(ex.toString());
101                 }
102             }
103             @Override
104             @SuppressWarnings("unused")
105             public java.lang.Object newInstance(java.lang.Object parent) {
106                 return null;
107             }
108         };
109         desc.setSchemaType("list");
110         desc.setComponentType("string");
111         desc.setHandler(handler);
112         desc.setNameSpaceURI("http://www.castor.org/binding/persistence");
113         desc.setRequired(true);
114         desc.setMultivalued(true);
115         addFieldDescriptor(desc);
116         addSequenceElement(desc);
117 
118         //-- validation code for: _keyList
119         fieldValidator = new org.exolab.castor.xml.FieldValidator();
120         fieldValidator.setMinOccurs(1);
121         { //-- local scope
122             org.exolab.castor.xml.validators.StringValidator typeValidator;
123             typeValidator = new org.exolab.castor.xml.validators.StringValidator();
124             fieldValidator.setValidator(typeValidator);
125             typeValidator.setWhiteSpace("preserve");
126         }
127         desc.setValidator(fieldValidator);
128     }
129 
130 
131       //-----------/
132      //- Methods -/
133     //-----------/
134 
135     /**
136      * Method getAccessMode.
137      * 
138      * @return the access mode specified for this class.
139      */
140     @Override()
141     public org.exolab.castor.mapping.AccessMode getAccessMode(
142     ) {
143         return null;
144     }
145 
146     /**
147      * Method getIdentity.
148      * 
149      * @return the identity field, null if this class has no
150      * identity.
151      */
152     @Override()
153     public org.exolab.castor.mapping.FieldDescriptor getIdentity(
154     ) {
155         return _identity;
156     }
157 
158     /**
159      * Method getJavaClass.
160      * 
161      * @return the Java class represented by this descriptor.
162      */
163     @Override()
164     public java.lang.Class getJavaClass(
165     ) {
166         return org.exolab.castor.xml.schema.annotations.jdo.PkType.class;
167     }
168 
169     /**
170      * Method getNameSpacePrefix.
171      * 
172      * @return the namespace prefix to use when marshaling as XML.
173      */
174     @Override()
175     public java.lang.String getNameSpacePrefix(
176     ) {
177         return _nsPrefix;
178     }
179 
180     /**
181      * Method getNameSpaceURI.
182      * 
183      * @return the namespace URI used when marshaling and
184      * unmarshaling as XML.
185      */
186     @Override()
187     public java.lang.String getNameSpaceURI(
188     ) {
189         return _nsURI;
190     }
191 
192     /**
193      * Method getValidator.
194      * 
195      * @return a specific validator for the class described by this
196      * ClassDescriptor.
197      */
198     @Override()
199     public org.exolab.castor.xml.TypeValidator getValidator(
200     ) {
201         return this;
202     }
203 
204     /**
205      * Method getXMLName.
206      * 
207      * @return the XML Name for the Class being described.
208      */
209     @Override()
210     public java.lang.String getXMLName(
211     ) {
212         return _xmlName;
213     }
214 
215     /**
216      * Method isElementDefinition.
217      * 
218      * @return true if XML schema definition of this Class is that
219      * of a global
220      * element or element with anonymous type definition.
221      */
222     public boolean isElementDefinition(
223     ) {
224         return _elementDefinition;
225     }
226 
227 }