1 55 package org.jboss.axis.description; 56 57 import org.jboss.axis.utils.Messages; 58 import org.jboss.axis.wsdl.symbolTable.TypeEntry; 59 60 import javax.xml.namespace.QName ; 61 import javax.xml.rpc.holders.Holder ; 62 63 71 public class ParameterDesc 72 { 73 public static final byte IN = 1; 75 public static final byte OUT = 2; 76 public static final byte INOUT = 3; 77 78 81 private transient QName name; 82 85 public TypeEntry typeEntry; 86 89 private byte mode = IN; 90 93 private QName typeQName; 94 97 private Class javaType = null; 98 101 private int order = -1; 102 105 private boolean isReturn = false; 106 109 private String mimeType = null; 110 111 114 private boolean inHeader = false; 115 private boolean outHeader = false; 116 117 public ParameterDesc() 118 { 119 } 120 121 126 public ParameterDesc(ParameterDesc copy) 127 { 128 name = copy.name; 129 typeEntry = copy.typeEntry; 130 mode = copy.mode; 131 typeQName = copy.typeQName; 132 javaType = copy.javaType; 133 order = copy.order; 134 isReturn = copy.isReturn; 135 mimeType = copy.mimeType; 136 inHeader = copy.inHeader; 137 outHeader = copy.outHeader; 138 } 139 140 147 public ParameterDesc(QName name, byte mode, QName typeQName) 148 { 149 this.name = name; 150 this.mode = mode; 151 this.typeQName = typeQName; 152 } 153 154 164 public ParameterDesc(QName name, byte mode, QName typeQName, 165 Class javaType, boolean inHeader, boolean outHeader) 166 { 167 this(name, mode, typeQName); 168 this.javaType = javaType; 169 this.inHeader = inHeader; 170 this.outHeader = outHeader; 171 } 172 173 180 public ParameterDesc(QName name, byte mode, QName typeQName, Class javaType) 181 { 182 this(name, mode, typeQName, javaType, false, false); 183 } 184 185 public String toString() 186 { 187 return toString(""); 188 } 189 190 public String toString(String indent) 191 { 192 String text = ""; 193 text += indent + "name: " + name + "\n"; 194 text += indent + "typeEntry: " + typeEntry + "\n"; 195 text += indent + "mode: " + (mode == IN ? 196 "IN" : mode == INOUT ? 197 "INOUT" : "OUT: " 198 + "position:" + order) + "\n"; 199 text += indent + "isReturn: " + isReturn + "\n"; 200 text += indent + "typeQName: " + typeQName + "\n"; 201 text += indent + "javaType: " + javaType + "\n"; 202 text += indent + "inHeader: " + inHeader + "\n"; 203 text += indent + "outHeader: " + outHeader + "\n"; 204 return text; 205 } 207 211 public static byte modeFromString(String modeStr) 212 { 213 byte ret = IN; 214 if (modeStr == null) 215 { 216 return IN; 217 } 218 else if (modeStr.equalsIgnoreCase("out")) 219 { 220 ret = OUT; 221 } 222 else if (modeStr.equalsIgnoreCase("inout")) 223 { 224 ret = INOUT; 225 } 226 return ret; 227 } 228 229 public static String getModeAsString(byte mode) 230 { 231 if (mode == INOUT) 232 { 233 return "inout"; 234 } 235 else if (mode == OUT) 236 { 237 return "out"; 238 } 239 else if (mode == IN) 240 { 241 return "in"; 242 } 243 244 throw new IllegalArgumentException (Messages.getMessage("badParameterMode", Byte.toString(mode))); 245 } 246 247 public QName getQName() 248 { 249 return name; 250 } 251 252 public String getName() 253 { 254 if (name == null) 255 { 256 return null; 257 } 258 else 259 { 260 return name.getLocalPart(); 261 } 262 } 263 264 public void setName(String name) 265 { 266 this.name = new QName ("", name); 267 } 268 269 public void setQName(QName name) 270 { 271 this.name = name; 272 } 273 274 public QName getTypeQName() 275 { 276 return typeQName; 277 } 278 279 public void setTypeQName(QName typeQName) 280 { 281 this.typeQName = typeQName; 282 } 283 284 289 public Class getJavaType() 290 { 291 return javaType; 292 } 293 294 297 public void setJavaType(Class javaType) 298 { 299 if (javaType != null && !isReturn && mode != IN) 302 { 303 if (!Holder .class.isAssignableFrom(javaType)) 304 { 305 throw new IllegalArgumentException (Messages.getMessage("setJavaTypeErr00", 306 javaType.getName(), getModeAsString(mode))); 307 } 308 } 309 310 this.javaType = javaType; 311 } 312 313 public byte getMode() 314 { 315 return mode; 316 } 317 318 public void setMode(byte mode) 319 { 320 this.mode = mode; 321 } 322 323 public int getOrder() 324 { 325 return order; 326 } 327 328 public void setOrder(int order) 329 { 330 this.order = order; 331 } 332 333 public void setInHeader(boolean value) 334 { 335 this.inHeader = value; 336 } 337 338 public boolean isInHeader() 339 { 340 return this.inHeader; 341 } 342 343 public void setOutHeader(boolean value) 344 { 345 this.outHeader = value; 346 } 347 348 public boolean isOutHeader() 349 { 350 return this.outHeader; 351 } 352 353 358 public boolean getIsReturn() 359 { 360 return isReturn; 361 } 362 363 368 public void setIsReturn(boolean value) 369 { 370 isReturn = value; 371 } 372 } 373 | Popular Tags |