View Javadoc

1   /***
2    * @(#)ParameterDescriptor.java
3    * 
4    * JFoxSOAF, Service-Oriented Application Framework
5    * 
6    * Copyright(c) JFoxSOAF Team
7    * 
8    * Licensed under the GNU LGPL, Version 2.1 (the "License"); 
9    * you may not use this file except in compliance with the License. 
10   * You may obtain a copy of the License at  
11   * 
12   * http://www.gnu.org/copyleft/lesser.html
13   * 
14   * Unless required by applicable law or agreed to in writing, software
15   * distributed under the License is distributed on an "AS IS" BASIS, 
16   * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 
17   * See the License for the specific language governing permissions and 
18   * limitations under the License. 
19   * 
20   * For more information, please visit:
21   * http://www.jfox.cn/confluence/display/JFoxSOAF/Home
22   * http://www.huihoo.org/jfox/jfoxsoaf
23   */
24  
25  package org.huihoo.jfox.soaf.schema.service;
26  
27  import org.exolab.castor.xml.validators.StringValidator;
28  
29  /***
30   * <p>
31   * Class ParameterDescriptor.
32   * </p>
33   * 
34   * @author <a href="mailto:founder_chen@yahoo.com.cn">Peter Cheng </a>
35   * @version $Revision: 1.8 $ $Date: 2005/05/22 06:48:07 $
36   * @version Revision: 1.0
37   */
38  
39  public class ParameterDescriptor extends
40          org.exolab.castor.xml.util.XMLClassDescriptorImpl {
41  
42      /***
43       * Field nsPrefix
44       */
45      private java.lang.String nsPrefix;
46  
47      /***
48       * Field nsURI
49       */
50      private java.lang.String nsURI;
51  
52      /***
53       * Field xmlName
54       */
55      private java.lang.String xmlName;
56  
57      /***
58       * Field identity
59       */
60      private org.exolab.castor.xml.XMLFieldDescriptor identity;
61  
62      public ParameterDescriptor() {
63          super();
64          xmlName = "parameter";
65  
66          //-- set grouping compositor
67          setCompositorAsSequence();
68          org.exolab.castor.xml.util.XMLFieldDescriptorImpl desc = null;
69          org.exolab.castor.xml.XMLFieldHandler handler = null;
70          org.exolab.castor.xml.FieldValidator fieldValidator = null;
71          //-- initialize attribute descriptors
72  
73          //-- initialize element descriptors
74  
75          //-- _name
76          desc = new org.exolab.castor.xml.util.XMLFieldDescriptorImpl(
77                  java.lang.String.class, "_name", "name",
78                  org.exolab.castor.xml.NodeType.Element);
79          desc.setImmutable(true);
80          handler = (new org.exolab.castor.xml.XMLFieldHandler() {
81              public java.lang.Object getValue(java.lang.Object object)
82                      throws IllegalStateException {
83                  Parameter target = (Parameter) object;
84                  return target.getName();
85              }
86  
87              public void setValue(java.lang.Object object, java.lang.Object value)
88                      throws IllegalStateException, IllegalArgumentException {
89                  try {
90                      Parameter target = (Parameter) object;
91                      target.setName((java.lang.String) value);
92                  } catch (java.lang.Exception ex) {
93                      throw new IllegalStateException(ex.toString());
94                  }
95              }
96  
97              public java.lang.Object newInstance(java.lang.Object parent) {
98                  return null;
99              }
100         });
101         desc.setHandler(handler);
102         desc.setRequired(true);
103         desc.setMultivalued(false);
104         addFieldDescriptor(desc);
105 
106         //-- validation code for: _name
107         fieldValidator = new org.exolab.castor.xml.FieldValidator();
108         fieldValidator.setMinOccurs(1);
109         { //-- local scope
110             StringValidator typeValidator = new StringValidator();
111             typeValidator.setWhiteSpace("preserve");
112             fieldValidator.setValidator(typeValidator);
113         }
114         desc.setValidator(fieldValidator);
115         //-- _value
116         desc = new org.exolab.castor.xml.util.XMLFieldDescriptorImpl(
117                 java.lang.String.class, "_value", "value",
118                 org.exolab.castor.xml.NodeType.Element);
119         desc.setImmutable(true);
120         handler = (new org.exolab.castor.xml.XMLFieldHandler() {
121             public java.lang.Object getValue(java.lang.Object object)
122                     throws IllegalStateException {
123                 Parameter target = (Parameter) object;
124                 return target.getValue();
125             }
126 
127             public void setValue(java.lang.Object object, java.lang.Object value)
128                     throws IllegalStateException, IllegalArgumentException {
129                 try {
130                     Parameter target = (Parameter) object;
131                     target.setValue((java.lang.String) value);
132                 } catch (java.lang.Exception ex) {
133                     throw new IllegalStateException(ex.toString());
134                 }
135             }
136 
137             public java.lang.Object newInstance(java.lang.Object parent) {
138                 return null;
139             }
140         });
141         desc.setHandler(handler);
142         desc.setRequired(true);
143         desc.setMultivalued(false);
144         addFieldDescriptor(desc);
145 
146         //-- validation code for: _value
147         fieldValidator = new org.exolab.castor.xml.FieldValidator();
148         fieldValidator.setMinOccurs(1);
149         { //-- local scope
150             StringValidator typeValidator = new StringValidator();
151             typeValidator.setWhiteSpace("preserve");
152             fieldValidator.setValidator(typeValidator);
153         }
154         desc.setValidator(fieldValidator);
155     }
156 
157     /***
158      * Method getAccessMode
159      */
160     public org.exolab.castor.mapping.AccessMode getAccessMode() {
161         return null;
162     }
163 
164     /***
165      * Method getExtends
166      */
167     public org.exolab.castor.mapping.ClassDescriptor getExtends() {
168         return null;
169     }
170 
171     /***
172      * Method getIdentity
173      */
174     public org.exolab.castor.mapping.FieldDescriptor getIdentity() {
175         return identity;
176     }
177 
178     /***
179      * Method getJavaClass
180      */
181     public java.lang.Class getJavaClass() {
182         return org.huihoo.jfox.soaf.schema.service.Parameter.class;
183     }
184 
185     /***
186      * Method getNameSpacePrefix
187      */
188     public java.lang.String getNameSpacePrefix() {
189         return nsPrefix;
190     }
191 
192     /***
193      * Method getNameSpaceURI
194      */
195     public java.lang.String getNameSpaceURI() {
196         return nsURI;
197     }
198 
199     /***
200      * Method getValidator
201      */
202     public org.exolab.castor.xml.TypeValidator getValidator() {
203         return this;
204     }
205 
206     /***
207      * Method getXMLName
208      */
209     public java.lang.String getXMLName() {
210         return xmlName;
211     }
212 
213 }