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

The following examples show how to use javax.jws.WebParam#name() . 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 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 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: JaxWsServiceConfiguration.java    From cxf with Apache License 2.0 5 votes vote down vote up
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 4
Source File: NullArgumentTestBase.java    From development with Apache License 2.0 5 votes vote down vote up
private String getParameterName(Annotation[] paramAnnotations, Method method) {
    for (Annotation a : paramAnnotations) {
        if (a instanceof WebParam) {
            WebParam webparam = (WebParam) a;
            return webparam.name();
        }
    }
    fail("Missing WebParam annotation in method " + method.getName());
    return null;
}
 
Example 5
Source File: ParameterNamesTest.java    From development with Apache License 2.0 5 votes vote down vote up
private String getParameterName(Annotation[] annotations) {
    for (Annotation a : annotations) {
        if (a instanceof WebParam) {
            WebParam webparam = (WebParam) a;
            return webparam.name();
        }
    }
    fail("Missing WebParam annotation");
    return null;
}
 
Example 6
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 7
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 8
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 9
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 10
Source File: SMethod.java    From BIMserver with GNU Affero General Public License v3.0 5 votes vote down vote up
@SuppressWarnings("rawtypes")
public SMethod(SService service, Method method) {
	this.service = service;
	this.method = method;
	
	WebMethod webMethod = method.getAnnotation(WebMethod.class);
	if (webMethod == null) {
		this.name = method.getName();
		LOGGER.warn("Method " + method.getName() + " has no @WebMethod annotation");
	} else {
		this.name = webMethod.action();
	}
	
	int parameterCounter = 0;
	for (Class<?> parameterType : method.getParameterTypes()) {
		String paramName = "arg" + parameterCounter;
		WebParam webParam = extractAnnotation(parameterCounter, WebParam.class);
		if (webParam != null) {
			paramName = webParam.name();
		} else {
			LOGGER.warn("Method " + method.getName() + " parameter " + parameterCounter + " has no @WebParam annotation");
		}
		Class<?> genericType = getGenericReturnType(parameterCounter);
		parameters.add(new SParameter(this, service.getServicesMap().getSType(parameterType.getName()), genericType == null ? null : service.getServicesMap().getSType(genericType.getName()), paramName));
		parameterCounter++;			
	}
	this.returnType = service.getServicesMap().getSType(method.getReturnType().getName());
	if (method.getReturnType() == List.class || method.getReturnType() == Set.class) {
		Type genericReturnType = method.getGenericReturnType();
		ParameterizedType parameterizedType = (ParameterizedType)genericReturnType;
		Type type = parameterizedType.getActualTypeArguments()[0];
		if (type instanceof Class) {
			this.genericReturnType = service.getServicesMap().getSType(((Class)type).getName());
		}
	}
	}
 
Example 11
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 12
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 13
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 14
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 15
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 16
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 17
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 18
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 19
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 20
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;
}