KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > apache > axis > wsdl > symbolTable > Parameter


1 /*
2  * Copyright 2001-2004 The Apache Software Foundation.
3  *
4  * Licensed under the Apache License, Version 2.0 (the "License");
5  * you may not use this file except in compliance with the License.
6  * You may obtain a copy of the License at
7  *
8  * http://www.apache.org/licenses/LICENSE-2.0
9  *
10  * Unless required by applicable law or agreed to in writing, software
11  * distributed under the License is distributed on an "AS IS" BASIS,
12  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13  * See the License for the specific language governing permissions and
14  * limitations under the License.
15  */

16 package org.apache.axis.wsdl.symbolTable;
17
18 import javax.xml.namespace.QName JavaDoc;
19
20 /**
21  * This class simply collects
22  */

23 public class Parameter {
24
25     // constant values for the parameter mode.
26

27     /** Field IN */
28     public static final byte IN = 1;
29
30     /** Field OUT */
31     public static final byte OUT = 2;
32
33     /** Field INOUT */
34     public static final byte INOUT = 3;
35
36     // The QName of the element associated with this param. Defaults to
37
// null, which means it'll be new QName("", name)
38

39     /** Field qname */
40     private QName JavaDoc qname;
41
42     // The part name of this parameter, just a string.
43

44     /** Field name */
45     private String JavaDoc name;
46
47     // The MIME type of this parameter, null if it isn't a MIME type.
48

49     /** Field mimeInfo */
50     private MimeInfo mimeInfo = null;
51
52     /** Field type */
53     private TypeEntry type;
54
55     /** Field mode */
56     private byte mode = IN;
57
58     // Flags indicating whether the parameter goes into the soap message as
59
// a header.
60

61     /** Field inHeader */
62     private boolean inHeader = false;
63
64     /** Field outHeader */
65     private boolean outHeader = false;
66     
67     /** Is this an omittable param? */
68     private boolean omittable = false;
69
70     /**
71      * Method toString
72      *
73      * @return
74      */

75     public String JavaDoc toString() {
76
77         return "(" + type + ((mimeInfo == null)
78                 ? ""
79                 : "(" + mimeInfo + ")") + ", " + getName() + ", "
80                 + ((mode == IN)
81                 ? "IN)"
82                 : (mode == INOUT)
83                 ? "INOUT)"
84                 : "OUT)" + (inHeader
85                 ? "(IN soap:header)"
86                 : "") + (outHeader
87                 ? "(OUT soap:header)"
88                 : ""));
89     } // toString
90

91     /**
92      * Get the fully qualified name of this parameter.
93      *
94      * @return
95      */

96     public QName JavaDoc getQName() {
97         return qname;
98     }
99
100     /**
101      * Get the name of this parameter. This call is equivalent to
102      * getQName().getLocalPart().
103      *
104      * @return
105      */

106     public String JavaDoc getName() {
107
108         if ((name == null) && (qname != null)) {
109             return qname.getLocalPart();
110         }
111
112         return name;
113     }
114
115     /**
116      * Set the name of the parameter. This replaces both the
117      * name and the QName (the namespaces becomes "").
118      *
119      * @param name
120      */

121     public void setName(String JavaDoc name) {
122
123         this.name = name;
124
125         if (qname == null) {
126             this.qname = new QName JavaDoc("", name);
127         }
128     }
129
130     /**
131      * Set the QName of the parameter.
132      *
133      * @param qname
134      */

135     public void setQName(QName JavaDoc qname) {
136         this.qname = qname;
137     }
138
139     /**
140      * Get the MIME type of the parameter.
141      *
142      * @return
143      */

144     public MimeInfo getMIMEInfo() {
145         return mimeInfo;
146     } // getMIMEType
147

148     /**
149      * Set the MIME type of the parameter.
150      *
151      * @param mimeInfo
152      */

153     public void setMIMEInfo(MimeInfo mimeInfo) {
154         this.mimeInfo = mimeInfo;
155     } // setMIMEType
156

157     /**
158      * Get the TypeEntry of the parameter.
159      *
160      * @return
161      */

162     public TypeEntry getType() {
163         return type;
164     }
165
166     /**
167      * Set the TypeEntry of the parameter.
168      *
169      * @param type
170      */

171     public void setType(TypeEntry type) {
172         this.type = type;
173     }
174
175     /**
176      * Get the mode (IN, INOUT, OUT) of the parameter.
177      *
178      * @return
179      */

180     public byte getMode() {
181         return mode;
182     }
183
184     /**
185      * Set the mode (IN, INOUT, OUT) of the parameter. If the input
186      * to this method is not one of IN, INOUT, OUT, then the value
187      * remains unchanged.
188      *
189      * @param mode
190      */

191     public void setMode(byte mode) {
192
193         if (mode <= INOUT && mode >= IN) {
194             this.mode = mode;
195         }
196     }
197
198     /**
199      * Is this parameter in the input message header?
200      *
201      * @return
202      */

203     public boolean isInHeader() {
204         return inHeader;
205     } // isInHeader
206

207     /**
208      * Set the inHeader flag for this parameter.
209      *
210      * @param inHeader
211      */

212     public void setInHeader(boolean inHeader) {
213         this.inHeader = inHeader;
214     } // setInHeader
215

216     /**
217      * Is this parameter in the output message header?
218      *
219      * @return
220      */

221     public boolean isOutHeader() {
222         return outHeader;
223     } // isOutHeader
224

225     /**
226      * Set the outHeader flag for this parameter.
227      *
228      * @param outHeader
229      */

230     public void setOutHeader(boolean outHeader) {
231         this.outHeader = outHeader;
232     } // setOutHeader
233

234     public boolean isOmittable() {
235         return omittable;
236     }
237
238     public void setOmittable(boolean omittable) {
239         this.omittable = omittable;
240     }
241 } // class Parameter
242
Popular Tags