JavaImplWriterpublic class JavaImplWriter extends JavaClassWriter This is Wsdl2java's implementation template writer. It writes the Impl.java
file which contains the Impl class. |
Fields Summary |
---|
protected javax.wsdl.Binding | bindingField binding | protected org.apache.axis.wsdl.symbolTable.SymbolTable | symbolTableField symbolTable | protected org.apache.axis.wsdl.symbolTable.BindingEntry | bEntryField bEntry |
Methods Summary |
---|
protected java.lang.String | getImplementsText()Returns the appropriate implements text
String portTypeName =
(String) bEntry.getDynamicVar(JavaBindingWriter.INTERFACE_NAME);
String implementsText = "implements " + portTypeName;
return implementsText;
| protected void | writeFileBody(java.io.PrintWriter pw)Write the body of the binding's stub file.
List operations = binding.getBindingOperations();
for (int i = 0; i < operations.size(); ++i) {
BindingOperation operation = (BindingOperation) operations.get(i);
Operation ptOperation = operation.getOperation();
OperationType type = ptOperation.getStyle();
Parameters parameters =
bEntry.getParameters(operation.getOperation());
// These operation types are not supported. The signature
// will be a string stating that fact.
if ((OperationType.NOTIFICATION.equals(type))
|| (OperationType.SOLICIT_RESPONSE.equals(type))) {
pw.println(parameters.signature);
pw.println();
} else {
writeOperation(pw, parameters);
}
}
| protected void | writeOperation(java.io.PrintWriter pw, org.apache.axis.wsdl.symbolTable.Parameters parms)Write the implementation template for the given operation.
pw.println(parms.signature + " {");
// Fill in any out parameter holders
Iterator iparam = parms.list.iterator();
while (iparam.hasNext()) {
Parameter param = (Parameter) iparam.next();
if (param.getMode() == Parameter.OUT) {
// write a constructor for each of the parameters
BooleanHolder bThrow = new BooleanHolder(false);
String constructorString =
Utils.getConstructorForParam(param, symbolTable, bThrow);
if (bThrow.value) {
pw.println(" try {");
}
pw.println(" " + Utils.xmlNameToJava(param.getName())
+ ".value = " + constructorString + ";");
if (bThrow.value) {
pw.println(" } catch (Exception e) {");
pw.println(" }");
}
}
}
// Print the return statement
Parameter returnParam = parms.returnParam;
if (returnParam != null) {
TypeEntry returnType = returnParam.getType();
pw.print(" return ");
if (!returnParam.isOmittable() &&
Utils.isPrimitiveType(returnType)) {
String returnString = returnType.getName();
if ("boolean".equals(returnString)) {
pw.println("false;");
} else if ("byte".equals(returnString)) {
pw.println("(byte)-3;");
} else if ("short".equals(returnString)) {
pw.println("(short)-3;");
} else {
pw.println("-3;");
}
} else {
pw.println("null;");
}
}
pw.println(" }");
pw.println();
|
|