if (ja instanceof JavaParameter) {
parameter = (JavaParameter) ja;
} else {
throw new RuntimeException("WebParamAnnotator only annotate the JavaParameter");
}
JavaMethod method = parameter.getMethod();
if (method.hasParameter(parameter.getName())) {
JavaParameter paramInList = method.getParameter(parameter.getName());
if (paramInList.isIN() && parameter.isOUT()) {
parameter.setStyle(JavaType.Style.INOUT);
}
}
JAnnotation webParamAnnotation = new JAnnotation(WebParam.class);
String name = parameter.getName();
String targetNamespace = method.getInterface().getNamespace();
String partName = null;
if (method.getSoapStyle() == SOAPBinding.Style.DOCUMENT
|| parameter.isHeader()) {
targetNamespace = parameter.getTargetNamespace();
if (parameter.getQName() != null) {
name = parameter.getQName().getLocalPart();
}
if (!method.isWrapperStyle()) {
partName = parameter.getPartName();
}
}
if (method.getSoapStyle() == SOAPBinding.Style.RPC) {
name = parameter.getPartName();
partName = parameter.getPartName();
}
if (partName != null) {
webParamAnnotation.addElement(new JAnnotationElement("partName", partName));
}
if (parameter.getStyle() == JavaType.Style.OUT) {
webParamAnnotation.addElement(new JAnnotationElement("mode", WebParam.Mode.OUT));
} else if (parameter.getStyle() == JavaType.Style.INOUT) {
webParamAnnotation.addElement(new JAnnotationElement("mode", WebParam.Mode.INOUT));
}
webParamAnnotation.addElement(new JAnnotationElement("name", name));
if (null != targetNamespace
&& (method.getSoapStyle() == SOAPBinding.Style.DOCUMENT || parameter.isHeader())) {
webParamAnnotation.addElement(new JAnnotationElement("targetNamespace",
targetNamespace));
}
parameter.setAnnotation(webParamAnnotation);