Java Code Examples for javax.jws.WebParam#targetNamespace()

The following examples show how to use javax.jws.WebParam#targetNamespace() . 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: AbstractWrapperBeanGenerator.java    From openjdk-jdk9 with GNU General Public License v2.0 5 votes vote down vote up
/**
     * 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 2
Source File: JaxWsServiceConfiguration.java    From cxf with Apache License 2.0 5 votes vote down vote up
private QName getParameterName(OperationInfo op, Method method, int paramNumber,
                               int curSize, String prefix, boolean input) {
    int partIndex = getPartIndex(method, paramNumber, input);
    method = getDeclaredMethod(method);
    WebParam param = getWebParam(method, paramNumber);
    String tns = null;
    String local = null;
    if (param != null) {
        tns = param.targetNamespace();
        local = param.name();
    }

    if (tns == null || tns.length() == 0) {
        QName wrappername = null;
        if (input) {
            wrappername = getRequestWrapperName(op, method);
        } else {
            wrappername = getResponseWrapperName(op, method);
        }
        if (wrappername != null) {
            tns = wrappername.getNamespaceURI();
        }
    }
    if (tns == null || tns.length() == 0) {
        tns = op.getName().getNamespaceURI();
    }

    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();
            if (!input) {
                local += "Response";
            }
        }
    }

    return new QName(tns, local);
}
 
Example 3
Source File: AbstractWrapperBeanGenerator.java    From openjdk-8 with GNU General Public License v2.0 5 votes vote down vote up
/**
     * 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 4
Source File: AbstractWrapperBeanGenerator.java    From openjdk-8-source with GNU General Public License v2.0 5 votes vote down vote up
/**
     * 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 5
Source File: AbstractWrapperBeanGenerator.java    From hottub with GNU General Public License v2.0 5 votes vote down vote up
/**
     * 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 6
Source File: AbstractWrapperBeanGenerator.java    From TencentKona-8 with GNU General Public License v2.0 5 votes vote down vote up
/**
     * 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 7
Source File: AbstractWrapperBeanGenerator.java    From openjdk-jdk8u-backup with GNU General Public License v2.0 5 votes vote down vote up
/**
     * 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 8
Source File: AbstractWrapperBeanGenerator.java    From openjdk-jdk8u with GNU General Public License v2.0 5 votes vote down vote up
/**
     * 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: AbstractWrapperBeanGenerator.java    From jdk8u60 with GNU General Public License v2.0 5 votes vote down vote up
/**
     * 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 10
Source File: AbstractWrapperBeanGenerator.java    From openjdk-jdk8u-backup with GNU General Public License v2.0 4 votes vote down vote up
/**
 * 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 11
Source File: AbstractWrapperBeanGenerator.java    From openjdk-jdk8u with GNU General Public License v2.0 4 votes vote down vote up
/**
 * 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 12
Source File: AbstractWrapperBeanGenerator.java    From openjdk-jdk9 with GNU General Public License v2.0 4 votes vote down vote up
/**
 * 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 13
Source File: AbstractWrapperBeanGenerator.java    From hottub with GNU General Public License v2.0 4 votes vote down vote up
/**
 * 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 14
Source File: AbstractWrapperBeanGenerator.java    From jdk8u60 with GNU General Public License v2.0 4 votes vote down vote up
/**
 * 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 vote down vote up
/**
 * 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 openjdk-8 with GNU General Public License v2.0 4 votes vote down vote up
/**
 * 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 TencentKona-8 with GNU General Public License v2.0 4 votes vote down vote up
/**
 * 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;
}