use of org.apache.cxf.tools.wsdlto.frontend.jaxws.processor.internal.annotator.WebParamAnnotator in project cxf by apache.
the class ParameterProcessor method addParameter.
protected JavaParameter addParameter(MessagePartInfo mpart, JavaMethod method, JavaParameter parameter) throws ToolException {
if (parameter == null) {
return null;
}
String name = parameter.getName();
int count = 0;
while (method.getParameter(parameter.getName()) != null && context.optionSet(ToolConstants.CFG_AUTORESOLVE) && parameter.getStyle() != JavaType.Style.INOUT) {
parameter.setName(name + (++count));
}
parameter.setMethod(method);
parameter.annotate(new WebParamAnnotator(isOutOfBandHeader(mpart)));
method.addParameter(parameter);
return parameter;
}
use of org.apache.cxf.tools.wsdlto.frontend.jaxws.processor.internal.annotator.WebParamAnnotator in project cxf by apache.
the class ParameterProcessor method processOutput.
private void processOutput(JavaMethod method, MessageInfo inputMessage, MessageInfo outputMessage) throws ToolException {
Map<QName, MessagePartInfo> inputPartsMap = inputMessage.getMessagePartsMap();
List<MessagePartInfo> outputParts = outputMessage == null ? new ArrayList<>() : outputMessage.getMessageParts();
// figure out output parts that are not present in input parts
List<MessagePartInfo> outParts = new ArrayList<>();
int numHeader = 0;
if (isRequestResponse(method)) {
for (MessagePartInfo outpart : outputParts) {
boolean oob = false;
if (isOutOfBandHeader(outpart)) {
if (!requireOutOfBandHeader()) {
continue;
}
oob = true;
}
MessagePartInfo inpart = inputPartsMap.get(outpart.getName());
if (inpart == null) {
outParts.add(outpart);
if (oob) {
numHeader++;
}
continue;
} else if (isSamePart(inpart, outpart)) {
boolean found = false;
for (JavaParameter p : method.getParameters()) {
if (p.getQName().equals(ProcessorUtil.getElementName(outpart)) && p.getPartName().equals(outpart.getName().getLocalPart())) {
p.setHolder(true);
p.setHolderName(javax.xml.ws.Holder.class.getName());
String holderClass = p.getClassName();
if (JAXBUtils.holderClass(holderClass) != null) {
holderClass = JAXBUtils.holderClass(holderClass).getName();
}
p.setClassName(holderClass);
p.getAnnotations().clear();
p.setStyle(JavaType.Style.INOUT);
p.annotate(new WebParamAnnotator(isOutOfBandHeader(outpart)));
found = true;
}
}
if (!found) {
addParameter(outpart, method, getParameterFromPart(method, outpart, JavaType.Style.INOUT));
}
continue;
} else if (!isSamePart(inpart, outpart)) {
if (oob) {
numHeader++;
}
outParts.add(outpart);
continue;
}
}
}
if (isRequestResponse(method)) {
if (outParts.size() - numHeader == 1 && !isHeader(outParts.get(0))) {
processReturn(method, outParts.get(0));
outParts.remove(0);
} else {
processReturn(method, null);
}
JAXWSBinding mBinding = outputMessage.getOperation().getExtensor(JAXWSBinding.class);
for (MessagePartInfo part : outParts) {
JavaParameter param = getParameterFromPart(method, part, JavaType.Style.OUT);
if (mBinding != null && mBinding.getJaxwsParas() != null) {
for (JAXWSParameter jwp : mBinding.getJaxwsParas()) {
if (part.getName().getLocalPart().equals(jwp.getPart())) {
param.setName(jwp.getName());
}
}
}
addParameter(part, method, param);
}
} else {
processReturn(method, null);
}
}
Aggregations