Java Code Examples for javax.jws.WebParam#header()
The following examples show how to use
javax.jws.WebParam#header() .
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: WebServiceVisitor.java From jdk8u60 with GNU General Public License v2.0 | 6 votes |
protected int getModeParameterCount(ExecutableElement method, WebParam.Mode mode) { WebParam webParam; int cnt = 0; for (VariableElement param : method.getParameters()) { webParam = param.getAnnotation(WebParam.class); if (webParam != null) { if (webParam.header()) continue; if (isEquivalentModes(mode, webParam.mode())) cnt++; } else { if (isEquivalentModes(mode, WebParam.Mode.IN)) { cnt++; } } } return cnt; }
Example 2
Source File: WebServiceVisitor.java From openjdk-jdk8u with GNU General Public License v2.0 | 6 votes |
protected int getModeParameterCount(ExecutableElement method, WebParam.Mode mode) { WebParam webParam; int cnt = 0; for (VariableElement param : method.getParameters()) { webParam = param.getAnnotation(WebParam.class); if (webParam != null) { if (webParam.header()) continue; if (isEquivalentModes(mode, webParam.mode())) cnt++; } else { if (isEquivalentModes(mode, WebParam.Mode.IN)) { cnt++; } } } return cnt; }
Example 3
Source File: WebServiceVisitor.java From openjdk-8 with GNU General Public License v2.0 | 6 votes |
protected int getModeParameterCount(ExecutableElement method, WebParam.Mode mode) { WebParam webParam; int cnt = 0; for (VariableElement param : method.getParameters()) { webParam = param.getAnnotation(WebParam.class); if (webParam != null) { if (webParam.header()) continue; if (isEquivalentModes(mode, webParam.mode())) cnt++; } else { if (isEquivalentModes(mode, WebParam.Mode.IN)) { cnt++; } } } return cnt; }
Example 4
Source File: WebServiceVisitor.java From openjdk-8-source with GNU General Public License v2.0 | 6 votes |
protected int getModeParameterCount(ExecutableElement method, WebParam.Mode mode) { WebParam webParam; int cnt = 0; for (VariableElement param : method.getParameters()) { webParam = param.getAnnotation(WebParam.class); if (webParam != null) { if (webParam.header()) continue; if (isEquivalentModes(mode, webParam.mode())) cnt++; } else { if (isEquivalentModes(mode, WebParam.Mode.IN)) { cnt++; } } } return cnt; }
Example 5
Source File: WebServiceVisitor.java From hottub with GNU General Public License v2.0 | 6 votes |
protected int getModeParameterCount(ExecutableElement method, WebParam.Mode mode) { WebParam webParam; int cnt = 0; for (VariableElement param : method.getParameters()) { webParam = param.getAnnotation(WebParam.class); if (webParam != null) { if (webParam.header()) continue; if (isEquivalentModes(mode, webParam.mode())) cnt++; } else { if (isEquivalentModes(mode, WebParam.Mode.IN)) { cnt++; } } } return cnt; }
Example 6
Source File: WebServiceVisitor.java From openjdk-jdk9 with GNU General Public License v2.0 | 6 votes |
protected int getModeParameterCount(ExecutableElement method, WebParam.Mode mode) { WebParam webParam; int cnt = 0; for (VariableElement param : method.getParameters()) { webParam = param.getAnnotation(WebParam.class); if (webParam != null) { if (webParam.header()) continue; if (isEquivalentModes(mode, webParam.mode())) cnt++; } else { if (isEquivalentModes(mode, WebParam.Mode.IN)) { cnt++; } } } return cnt; }
Example 7
Source File: JaxWsServiceConfiguration.java From cxf with Apache License 2.0 | 5 votes |
private QName getPartName(OperationInfo op, Method method, int paramNumber, MessageInfo mi, String prefix, boolean isIn) { int partIndex = getPartIndex(method, paramNumber, isIn); method = getDeclaredMethod(method); WebParam param = getWebParam(method, paramNumber); String tns = mi.getName().getNamespaceURI(); String local = null; if (param != null) { if (Boolean.TRUE.equals(isRPC(method)) || isDocumentBare(method) || param.header()) { local = param.partName(); } if (local == null || local.length() == 0) { local = param.name(); } } if (local == null || local.length() == 0) { if (Boolean.TRUE.equals(isRPC(method)) || !Boolean.FALSE.equals(isWrapped(method))) { local = getDefaultLocalName(op, method, paramNumber, partIndex, prefix); } else { local = getOperationName(op.getInterface(), method).getLocalPart(); } } return new QName(tns, local); }
Example 8
Source File: AbstractWrapperBeanGenerator.java From jdk8u60 with GNU General Public License v2.0 | 5 votes |
/** * Computes request bean members for a method. Collects all IN and INOUT * parameters as request bean fields. In this process, if a parameter * has any known JAXB annotations they are collected as well. * Special processing for @XmlElement annotation is done. * * @param method SEI method for which request bean members are computed * @return List of request bean members */ public List<A> collectRequestBeanMembers(M method) { List<A> requestMembers = new ArrayList<A>(); int paramIndex = -1; for (T param : nav.getMethodParameters(method)) { paramIndex++; WebParam webParam = annReader.getMethodParameterAnnotation(WebParam.class, method, paramIndex, null); if (webParam != null && (webParam.header() || webParam.mode().equals(WebParam.Mode.OUT))) { continue; } T holderType = getHolderValueType(param); // if (holderType != null && webParam != null && webParam.mode().equals(WebParam.Mode.IN)) { // // Should we flag an error - holder cannot be IN part ?? // continue; // } T paramType = (holderType != null) ? holderType : getSafeType(param); String paramName = (webParam != null && webParam.name().length() > 0) ? webParam.name() : "arg"+paramIndex; String paramNamespace = (webParam != null && webParam.targetNamespace().length() > 0) ? webParam.targetNamespace() : EMTPY_NAMESPACE_ID; // Collect JAXB annotations on a parameter List<Annotation> jaxbAnnotation = collectJAXBAnnotations(method, paramIndex); // If a parameter contains @XmlElement, process it. processXmlElement(jaxbAnnotation, paramName, paramNamespace, paramType); A member = factory.createWrapperBeanMember(paramType, getPropertyName(paramName), jaxbAnnotation); requestMembers.add(member); } return requestMembers; }
Example 9
Source File: JaxWsServiceConfiguration.java From cxf with Apache License 2.0 | 5 votes |
@Override public Boolean isHeader(Method method, int j) { method = getDeclaredMethod(method); if (j >= 0) { WebParam webParam = getWebParam(method, j); return webParam != null && webParam.header(); } WebResult webResult = getWebResult(method); return webResult != null && webResult.header(); }
Example 10
Source File: AbstractWrapperBeanGenerator.java From openjdk-jdk8u with GNU General Public License v2.0 | 5 votes |
/** * Computes request bean members for a method. Collects all IN and INOUT * parameters as request bean fields. In this process, if a parameter * has any known JAXB annotations they are collected as well. * Special processing for @XmlElement annotation is done. * * @param method SEI method for which request bean members are computed * @return List of request bean members */ public List<A> collectRequestBeanMembers(M method) { List<A> requestMembers = new ArrayList<A>(); int paramIndex = -1; for (T param : nav.getMethodParameters(method)) { paramIndex++; WebParam webParam = annReader.getMethodParameterAnnotation(WebParam.class, method, paramIndex, null); if (webParam != null && (webParam.header() || webParam.mode().equals(WebParam.Mode.OUT))) { continue; } T holderType = getHolderValueType(param); // if (holderType != null && webParam != null && webParam.mode().equals(WebParam.Mode.IN)) { // // Should we flag an error - holder cannot be IN part ?? // continue; // } T paramType = (holderType != null) ? holderType : getSafeType(param); String paramName = (webParam != null && webParam.name().length() > 0) ? webParam.name() : "arg"+paramIndex; String paramNamespace = (webParam != null && webParam.targetNamespace().length() > 0) ? webParam.targetNamespace() : EMTPY_NAMESPACE_ID; // Collect JAXB annotations on a parameter List<Annotation> jaxbAnnotation = collectJAXBAnnotations(method, paramIndex); // If a parameter contains @XmlElement, process it. processXmlElement(jaxbAnnotation, paramName, paramNamespace, paramType); A member = factory.createWrapperBeanMember(paramType, getPropertyName(paramName), jaxbAnnotation); requestMembers.add(member); } return requestMembers; }
Example 11
Source File: AbstractWrapperBeanGenerator.java From openjdk-8-source with GNU General Public License v2.0 | 5 votes |
/** * Computes request bean members for a method. Collects all IN and INOUT * parameters as request bean fields. In this process, if a parameter * has any known JAXB annotations they are collected as well. * Special processing for @XmlElement annotation is done. * * @param method SEI method for which request bean members are computed * @return List of request bean members */ public List<A> collectRequestBeanMembers(M method) { List<A> requestMembers = new ArrayList<A>(); int paramIndex = -1; for (T param : nav.getMethodParameters(method)) { paramIndex++; WebParam webParam = annReader.getMethodParameterAnnotation(WebParam.class, method, paramIndex, null); if (webParam != null && (webParam.header() || webParam.mode().equals(WebParam.Mode.OUT))) { continue; } T holderType = getHolderValueType(param); // if (holderType != null && webParam != null && webParam.mode().equals(WebParam.Mode.IN)) { // // Should we flag an error - holder cannot be IN part ?? // continue; // } T paramType = (holderType != null) ? holderType : getSafeType(param); String paramName = (webParam != null && webParam.name().length() > 0) ? webParam.name() : "arg"+paramIndex; String paramNamespace = (webParam != null && webParam.targetNamespace().length() > 0) ? webParam.targetNamespace() : EMTPY_NAMESPACE_ID; // Collect JAXB annotations on a parameter List<Annotation> jaxbAnnotation = collectJAXBAnnotations(method, paramIndex); // If a parameter contains @XmlElement, process it. processXmlElement(jaxbAnnotation, paramName, paramNamespace, paramType); A member = factory.createWrapperBeanMember(paramType, getPropertyName(paramName), jaxbAnnotation); requestMembers.add(member); } return requestMembers; }
Example 12
Source File: AbstractWrapperBeanGenerator.java From openjdk-jdk9 with GNU General Public License v2.0 | 5 votes |
/** * Computes request bean members for a method. Collects all IN and INOUT * parameters as request bean fields. In this process, if a parameter * has any known JAXB annotations they are collected as well. * Special processing for @XmlElement annotation is done. * * @param method SEI method for which request bean members are computed * @return List of request bean members */ public List<A> collectRequestBeanMembers(M method) { List<A> requestMembers = new ArrayList<A>(); int paramIndex = -1; for (T param : nav.getMethodParameters(method)) { paramIndex++; WebParam webParam = annReader.getMethodParameterAnnotation(WebParam.class, method, paramIndex, null); if (webParam != null && (webParam.header() || webParam.mode().equals(WebParam.Mode.OUT))) { continue; } T holderType = getHolderValueType(param); // if (holderType != null && webParam != null && webParam.mode().equals(WebParam.Mode.IN)) { // // Should we flag an error - holder cannot be IN part ?? // continue; // } T paramType = (holderType != null) ? holderType : getSafeType(param); String paramName = (webParam != null && webParam.name().length() > 0) ? webParam.name() : "arg"+paramIndex; String paramNamespace = (webParam != null && webParam.targetNamespace().length() > 0) ? webParam.targetNamespace() : EMTPY_NAMESPACE_ID; // Collect JAXB annotations on a parameter List<Annotation> jaxbAnnotation = collectJAXBAnnotations(method, paramIndex); // If a parameter contains @XmlElement, process it. processXmlElement(jaxbAnnotation, paramName, paramNamespace, paramType); A member = factory.createWrapperBeanMember(paramType, getPropertyName(paramName), jaxbAnnotation); requestMembers.add(member); } return requestMembers; }
Example 13
Source File: JaxWsServiceConfiguration.java From cxf with Apache License 2.0 | 5 votes |
@Override public String getResponseWrapperPartName(OperationInfo op, Method method) { method = getDeclaredMethod(method); WebResult webResult = getWebResult(method); ResponseWrapper rw = method.getAnnotation(ResponseWrapper.class); if (rw != null) { String pn = getWithReflection(ResponseWrapper.class, rw, "partName"); if (pn != null) { return pn; } } int countOut = 0; int countHeaders = 0; if (webResult != null && webResult.header()) { countHeaders++; } else if (method.getReturnType() != Void.TYPE) { countOut++; } for (int x = 0; x < method.getParameterTypes().length; x++) { WebParam parm = getWebParam(method, x); if (parm != null) { if (parm.header()) { countHeaders++; } if (parm.mode() != WebParam.Mode.IN) { countOut++; } } } if (countHeaders > 0 && countOut == 0) { //all outs are headers, thus it's an empty body part //thus return the default for an empty part of "result" return "result"; } return null; }
Example 14
Source File: AbstractWrapperBeanGenerator.java From openjdk-jdk8u-backup with GNU General Public License v2.0 | 4 votes |
/** * Computes response bean members for a method. Collects all OUT and INOUT * parameters as response bean fields. In this process, if a parameter * has any known JAXB annotations they are collected as well. * Special processing for @XmlElement annotation is done. * * @param method SEI method for which response bean members are computed * @return List of response bean members */ public List<A> collectResponseBeanMembers(M method) { List<A> responseMembers = new ArrayList<A>(); // return that need to be part response wrapper bean String responseElementName = RETURN; String responseNamespace = EMTPY_NAMESPACE_ID; boolean isResultHeader = false; WebResult webResult = annReader.getMethodAnnotation(WebResult.class, method ,null); if (webResult != null) { if (webResult.name().length() > 0) { responseElementName = webResult.name(); } if (webResult.targetNamespace().length() > 0) { responseNamespace = webResult.targetNamespace(); } isResultHeader = webResult.header(); } T returnType = getSafeType(nav.getReturnType(method)); if (!isVoidType(returnType) && !isResultHeader) { List<Annotation> jaxbRespAnnotations = collectJAXBAnnotations(method); processXmlElement(jaxbRespAnnotations, responseElementName, responseNamespace, returnType); responseMembers.add(factory.createWrapperBeanMember(returnType, getPropertyName(responseElementName), jaxbRespAnnotations)); } // Now parameters that need to be part response wrapper bean int paramIndex = -1; for (T param : nav.getMethodParameters(method)) { paramIndex++; T paramType = getHolderValueType(param); WebParam webParam = annReader.getMethodParameterAnnotation(WebParam.class, method, paramIndex, null); if (paramType == null || (webParam != null && webParam.header())) { continue; // not a holder or a header - so don't add it } String paramName = (webParam != null && webParam.name().length() > 0) ? webParam.name() : "arg"+paramIndex; String paramNamespace = (webParam != null && webParam.targetNamespace().length() > 0) ? webParam.targetNamespace() : EMTPY_NAMESPACE_ID; List<Annotation> jaxbAnnotation = collectJAXBAnnotations(method, paramIndex); processXmlElement(jaxbAnnotation, paramName, paramNamespace, paramType); A member = factory.createWrapperBeanMember(paramType, getPropertyName(paramName), jaxbAnnotation); responseMembers.add(member); } return responseMembers; }
Example 15
Source File: AbstractWrapperBeanGenerator.java From openjdk-8-source with GNU General Public License v2.0 | 4 votes |
/** * Computes response bean members for a method. Collects all OUT and INOUT * parameters as response bean fields. In this process, if a parameter * has any known JAXB annotations they are collected as well. * Special processing for @XmlElement annotation is done. * * @param method SEI method for which response bean members are computed * @return List of response bean members */ public List<A> collectResponseBeanMembers(M method) { List<A> responseMembers = new ArrayList<A>(); // return that need to be part response wrapper bean String responseElementName = RETURN; String responseNamespace = EMTPY_NAMESPACE_ID; boolean isResultHeader = false; WebResult webResult = annReader.getMethodAnnotation(WebResult.class, method ,null); if (webResult != null) { if (webResult.name().length() > 0) { responseElementName = webResult.name(); } if (webResult.targetNamespace().length() > 0) { responseNamespace = webResult.targetNamespace(); } isResultHeader = webResult.header(); } T returnType = getSafeType(nav.getReturnType(method)); if (!isVoidType(returnType) && !isResultHeader) { List<Annotation> jaxbRespAnnotations = collectJAXBAnnotations(method); processXmlElement(jaxbRespAnnotations, responseElementName, responseNamespace, returnType); responseMembers.add(factory.createWrapperBeanMember(returnType, getPropertyName(responseElementName), jaxbRespAnnotations)); } // Now parameters that need to be part response wrapper bean int paramIndex = -1; for (T param : nav.getMethodParameters(method)) { paramIndex++; T paramType = getHolderValueType(param); WebParam webParam = annReader.getMethodParameterAnnotation(WebParam.class, method, paramIndex, null); if (paramType == null || (webParam != null && webParam.header())) { continue; // not a holder or a header - so don't add it } String paramName = (webParam != null && webParam.name().length() > 0) ? webParam.name() : "arg"+paramIndex; String paramNamespace = (webParam != null && webParam.targetNamespace().length() > 0) ? webParam.targetNamespace() : EMTPY_NAMESPACE_ID; List<Annotation> jaxbAnnotation = collectJAXBAnnotations(method, paramIndex); processXmlElement(jaxbAnnotation, paramName, paramNamespace, paramType); A member = factory.createWrapperBeanMember(paramType, getPropertyName(paramName), jaxbAnnotation); responseMembers.add(member); } return responseMembers; }
Example 16
Source File: AbstractWrapperBeanGenerator.java From hottub with GNU General Public License v2.0 | 4 votes |
/** * Computes response bean members for a method. Collects all OUT and INOUT * parameters as response bean fields. In this process, if a parameter * has any known JAXB annotations they are collected as well. * Special processing for @XmlElement annotation is done. * * @param method SEI method for which response bean members are computed * @return List of response bean members */ public List<A> collectResponseBeanMembers(M method) { List<A> responseMembers = new ArrayList<A>(); // return that need to be part response wrapper bean String responseElementName = RETURN; String responseNamespace = EMTPY_NAMESPACE_ID; boolean isResultHeader = false; WebResult webResult = annReader.getMethodAnnotation(WebResult.class, method ,null); if (webResult != null) { if (webResult.name().length() > 0) { responseElementName = webResult.name(); } if (webResult.targetNamespace().length() > 0) { responseNamespace = webResult.targetNamespace(); } isResultHeader = webResult.header(); } T returnType = getSafeType(nav.getReturnType(method)); if (!isVoidType(returnType) && !isResultHeader) { List<Annotation> jaxbRespAnnotations = collectJAXBAnnotations(method); processXmlElement(jaxbRespAnnotations, responseElementName, responseNamespace, returnType); responseMembers.add(factory.createWrapperBeanMember(returnType, getPropertyName(responseElementName), jaxbRespAnnotations)); } // Now parameters that need to be part response wrapper bean int paramIndex = -1; for (T param : nav.getMethodParameters(method)) { paramIndex++; T paramType = getHolderValueType(param); WebParam webParam = annReader.getMethodParameterAnnotation(WebParam.class, method, paramIndex, null); if (paramType == null || (webParam != null && webParam.header())) { continue; // not a holder or a header - so don't add it } String paramName = (webParam != null && webParam.name().length() > 0) ? webParam.name() : "arg"+paramIndex; String paramNamespace = (webParam != null && webParam.targetNamespace().length() > 0) ? webParam.targetNamespace() : EMTPY_NAMESPACE_ID; List<Annotation> jaxbAnnotation = collectJAXBAnnotations(method, paramIndex); processXmlElement(jaxbAnnotation, paramName, paramNamespace, paramType); A member = factory.createWrapperBeanMember(paramType, getPropertyName(paramName), jaxbAnnotation); responseMembers.add(member); } return responseMembers; }
Example 17
Source File: AbstractWrapperBeanGenerator.java From openjdk-jdk9 with GNU General Public License v2.0 | 4 votes |
/** * Computes response bean members for a method. Collects all OUT and INOUT * parameters as response bean fields. In this process, if a parameter * has any known JAXB annotations they are collected as well. * Special processing for @XmlElement annotation is done. * * @param method SEI method for which response bean members are computed * @return List of response bean members */ public List<A> collectResponseBeanMembers(M method) { List<A> responseMembers = new ArrayList<A>(); // return that need to be part response wrapper bean String responseElementName = RETURN; String responseNamespace = EMTPY_NAMESPACE_ID; boolean isResultHeader = false; WebResult webResult = annReader.getMethodAnnotation(WebResult.class, method ,null); if (webResult != null) { if (webResult.name().length() > 0) { responseElementName = webResult.name(); } if (webResult.targetNamespace().length() > 0) { responseNamespace = webResult.targetNamespace(); } isResultHeader = webResult.header(); } T returnType = getSafeType(nav.getReturnType(method)); if (!isVoidType(returnType) && !isResultHeader) { List<Annotation> jaxbRespAnnotations = collectJAXBAnnotations(method); processXmlElement(jaxbRespAnnotations, responseElementName, responseNamespace, returnType); responseMembers.add(factory.createWrapperBeanMember(returnType, getPropertyName(responseElementName), jaxbRespAnnotations)); } // Now parameters that need to be part response wrapper bean int paramIndex = -1; for (T param : nav.getMethodParameters(method)) { paramIndex++; T paramType = getHolderValueType(param); WebParam webParam = annReader.getMethodParameterAnnotation(WebParam.class, method, paramIndex, null); if (paramType == null || (webParam != null && webParam.header())) { continue; // not a holder or a header - so don't add it } String paramName = (webParam != null && webParam.name().length() > 0) ? webParam.name() : "arg"+paramIndex; String paramNamespace = (webParam != null && webParam.targetNamespace().length() > 0) ? webParam.targetNamespace() : EMTPY_NAMESPACE_ID; List<Annotation> jaxbAnnotation = collectJAXBAnnotations(method, paramIndex); processXmlElement(jaxbAnnotation, paramName, paramNamespace, paramType); A member = factory.createWrapperBeanMember(paramType, getPropertyName(paramName), jaxbAnnotation); responseMembers.add(member); } return responseMembers; }
Example 18
Source File: AbstractWrapperBeanGenerator.java From openjdk-8 with GNU General Public License v2.0 | 4 votes |
/** * Computes response bean members for a method. Collects all OUT and INOUT * parameters as response bean fields. In this process, if a parameter * has any known JAXB annotations they are collected as well. * Special processing for @XmlElement annotation is done. * * @param method SEI method for which response bean members are computed * @return List of response bean members */ public List<A> collectResponseBeanMembers(M method) { List<A> responseMembers = new ArrayList<A>(); // return that need to be part response wrapper bean String responseElementName = RETURN; String responseNamespace = EMTPY_NAMESPACE_ID; boolean isResultHeader = false; WebResult webResult = annReader.getMethodAnnotation(WebResult.class, method ,null); if (webResult != null) { if (webResult.name().length() > 0) { responseElementName = webResult.name(); } if (webResult.targetNamespace().length() > 0) { responseNamespace = webResult.targetNamespace(); } isResultHeader = webResult.header(); } T returnType = getSafeType(nav.getReturnType(method)); if (!isVoidType(returnType) && !isResultHeader) { List<Annotation> jaxbRespAnnotations = collectJAXBAnnotations(method); processXmlElement(jaxbRespAnnotations, responseElementName, responseNamespace, returnType); responseMembers.add(factory.createWrapperBeanMember(returnType, getPropertyName(responseElementName), jaxbRespAnnotations)); } // Now parameters that need to be part response wrapper bean int paramIndex = -1; for (T param : nav.getMethodParameters(method)) { paramIndex++; T paramType = getHolderValueType(param); WebParam webParam = annReader.getMethodParameterAnnotation(WebParam.class, method, paramIndex, null); if (paramType == null || (webParam != null && webParam.header())) { continue; // not a holder or a header - so don't add it } String paramName = (webParam != null && webParam.name().length() > 0) ? webParam.name() : "arg"+paramIndex; String paramNamespace = (webParam != null && webParam.targetNamespace().length() > 0) ? webParam.targetNamespace() : EMTPY_NAMESPACE_ID; List<Annotation> jaxbAnnotation = collectJAXBAnnotations(method, paramIndex); processXmlElement(jaxbAnnotation, paramName, paramNamespace, paramType); A member = factory.createWrapperBeanMember(paramType, getPropertyName(paramName), jaxbAnnotation); responseMembers.add(member); } return responseMembers; }
Example 19
Source File: AbstractWrapperBeanGenerator.java From openjdk-jdk8u with GNU General Public License v2.0 | 4 votes |
/** * Computes response bean members for a method. Collects all OUT and INOUT * parameters as response bean fields. In this process, if a parameter * has any known JAXB annotations they are collected as well. * Special processing for @XmlElement annotation is done. * * @param method SEI method for which response bean members are computed * @return List of response bean members */ public List<A> collectResponseBeanMembers(M method) { List<A> responseMembers = new ArrayList<A>(); // return that need to be part response wrapper bean String responseElementName = RETURN; String responseNamespace = EMTPY_NAMESPACE_ID; boolean isResultHeader = false; WebResult webResult = annReader.getMethodAnnotation(WebResult.class, method ,null); if (webResult != null) { if (webResult.name().length() > 0) { responseElementName = webResult.name(); } if (webResult.targetNamespace().length() > 0) { responseNamespace = webResult.targetNamespace(); } isResultHeader = webResult.header(); } T returnType = getSafeType(nav.getReturnType(method)); if (!isVoidType(returnType) && !isResultHeader) { List<Annotation> jaxbRespAnnotations = collectJAXBAnnotations(method); processXmlElement(jaxbRespAnnotations, responseElementName, responseNamespace, returnType); responseMembers.add(factory.createWrapperBeanMember(returnType, getPropertyName(responseElementName), jaxbRespAnnotations)); } // Now parameters that need to be part response wrapper bean int paramIndex = -1; for (T param : nav.getMethodParameters(method)) { paramIndex++; T paramType = getHolderValueType(param); WebParam webParam = annReader.getMethodParameterAnnotation(WebParam.class, method, paramIndex, null); if (paramType == null || (webParam != null && webParam.header())) { continue; // not a holder or a header - so don't add it } String paramName = (webParam != null && webParam.name().length() > 0) ? webParam.name() : "arg"+paramIndex; String paramNamespace = (webParam != null && webParam.targetNamespace().length() > 0) ? webParam.targetNamespace() : EMTPY_NAMESPACE_ID; List<Annotation> jaxbAnnotation = collectJAXBAnnotations(method, paramIndex); processXmlElement(jaxbAnnotation, paramName, paramNamespace, paramType); A member = factory.createWrapperBeanMember(paramType, getPropertyName(paramName), jaxbAnnotation); responseMembers.add(member); } return responseMembers; }
Example 20
Source File: AbstractWrapperBeanGenerator.java From TencentKona-8 with GNU General Public License v2.0 | 4 votes |
/** * Computes response bean members for a method. Collects all OUT and INOUT * parameters as response bean fields. In this process, if a parameter * has any known JAXB annotations they are collected as well. * Special processing for @XmlElement annotation is done. * * @param method SEI method for which response bean members are computed * @return List of response bean members */ public List<A> collectResponseBeanMembers(M method) { List<A> responseMembers = new ArrayList<A>(); // return that need to be part response wrapper bean String responseElementName = RETURN; String responseNamespace = EMTPY_NAMESPACE_ID; boolean isResultHeader = false; WebResult webResult = annReader.getMethodAnnotation(WebResult.class, method ,null); if (webResult != null) { if (webResult.name().length() > 0) { responseElementName = webResult.name(); } if (webResult.targetNamespace().length() > 0) { responseNamespace = webResult.targetNamespace(); } isResultHeader = webResult.header(); } T returnType = getSafeType(nav.getReturnType(method)); if (!isVoidType(returnType) && !isResultHeader) { List<Annotation> jaxbRespAnnotations = collectJAXBAnnotations(method); processXmlElement(jaxbRespAnnotations, responseElementName, responseNamespace, returnType); responseMembers.add(factory.createWrapperBeanMember(returnType, getPropertyName(responseElementName), jaxbRespAnnotations)); } // Now parameters that need to be part response wrapper bean int paramIndex = -1; for (T param : nav.getMethodParameters(method)) { paramIndex++; T paramType = getHolderValueType(param); WebParam webParam = annReader.getMethodParameterAnnotation(WebParam.class, method, paramIndex, null); if (paramType == null || (webParam != null && webParam.header())) { continue; // not a holder or a header - so don't add it } String paramName = (webParam != null && webParam.name().length() > 0) ? webParam.name() : "arg"+paramIndex; String paramNamespace = (webParam != null && webParam.targetNamespace().length() > 0) ? webParam.targetNamespace() : EMTPY_NAMESPACE_ID; List<Annotation> jaxbAnnotation = collectJAXBAnnotations(method, paramIndex); processXmlElement(jaxbAnnotation, paramName, paramNamespace, paramType); A member = factory.createWrapperBeanMember(paramType, getPropertyName(paramName), jaxbAnnotation); responseMembers.add(member); } return responseMembers; }