javax.jws.WebParam.Mode Java Examples

The following examples show how to use javax.jws.WebParam.Mode. 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: Utils.java    From netbeans with Apache License 2.0 6 votes vote down vote up
private static void populateParam(CompilationController controller, VariableElement paramEl, ParamModel paramModel) {
    paramModel.setParamType(paramEl.asType().toString());
    TypeElement paramAnotationEl = controller.getElements().getTypeElement("javax.jws.WebParam"); //NOI18N
    List<? extends AnnotationMirror> paramAnnotations = paramEl.getAnnotationMirrors();
    for (AnnotationMirror anMirror : paramAnnotations) {
        if (controller.getTypes().isSameType(paramAnotationEl.asType(), anMirror.getAnnotationType())) {
            Map<? extends ExecutableElement, ? extends AnnotationValue> expressions = anMirror.getElementValues();
            for(Entry<? extends ExecutableElement, ? extends AnnotationValue> entry:
                expressions.entrySet()) 
            {
                ExecutableElement ex = entry.getKey();
                AnnotationValue value = entry.getValue();
                if (ex.getSimpleName().contentEquals("name")) { //NOI18N
                    paramModel.name = (String)value.getValue();
                } else if (ex.getSimpleName().contentEquals("partName")) { //NOI18N
                    paramModel.setPartName((String)value.getValue());
                } else if (ex.getSimpleName().contentEquals("targetNamespace")) { //NOI18N
                    paramModel.setTargetNamespace((String)value.getValue());
                } else if (ex.getSimpleName().contentEquals("mode")) { //NOI18N
                    paramModel.setMode(Mode.valueOf(value.getValue().toString()));
                }
            }
        }
    }
}
 
Example #2
Source File: ParameterImpl.java    From openjdk-jdk9 with GNU General Public License v2.0 5 votes vote down vote up
public ParameterImpl(JavaMethodImpl parent, TypeInfo type, Mode mode, int index) {
    assert type != null;

    this.typeInfo = type;
    this.name = type.tagName;
    this.mode = mode;
    this.index = index;
    this.parent = parent;
}
 
Example #3
Source File: RuntimeModeler.java    From openjdk-8-source with GNU General Public License v2.0 5 votes vote down vote up
private ParameterBinding getBinding(String operation, String part, boolean isHeader, Mode mode){
    if(binding == null){
        if(isHeader)
            return ParameterBinding.HEADER;
        else
            return ParameterBinding.BODY;
    }
    QName opName = new QName(binding.getBinding().getPortType().getName().getNamespaceURI(), operation);
    return binding.getBinding().getBinding(opName, part, mode);
}
 
Example #4
Source File: RuntimeModeler.java    From TencentKona-8 with GNU General Public License v2.0 5 votes vote down vote up
private ParameterBinding getBinding(String operation, String part, boolean isHeader, Mode mode){
    if(binding == null){
        if(isHeader)
            return ParameterBinding.HEADER;
        else
            return ParameterBinding.BODY;
    }
    QName opName = new QName(binding.getBinding().getPortType().getName().getNamespaceURI(), operation);
    return binding.getBinding().getBinding(opName, part, mode);
}
 
Example #5
Source File: WSDLBoundOperationImpl.java    From TencentKona-8 with GNU General Public License v2.0 5 votes vote down vote up
@Override
public EditableWSDLPart getPart(String partName, Mode mode) {
    if(mode==Mode.IN){
        return inParts.get(partName);
    }else if(mode==Mode.OUT){
        return outParts.get(partName);
    }
    return null;
}
 
Example #6
Source File: RuntimeModeler.java    From hottub with GNU General Public License v2.0 5 votes vote down vote up
private ParameterBinding getBinding(String operation, String part, boolean isHeader, Mode mode){
    if(binding == null){
        if(isHeader)
            return ParameterBinding.HEADER;
        else
            return ParameterBinding.BODY;
    }
    QName opName = new QName(binding.getBinding().getPortType().getName().getNamespaceURI(), operation);
    return binding.getBinding().getBinding(opName, part, mode);
}
 
Example #7
Source File: SOAPSEIModel.java    From TencentKona-8 with GNU General Public License v2.0 5 votes vote down vote up
public Set<QName> getKnownHeaders() {
    Set<QName> headers = new HashSet<QName>();
    for (JavaMethodImpl method : getJavaMethods()) {
        // fill in request headers
        Iterator<ParameterImpl> params = method.getRequestParameters().iterator();
        fillHeaders(params, headers, Mode.IN);

        // fill in response headers
        params = method.getResponseParameters().iterator();
        fillHeaders(params, headers, Mode.OUT);
    }
    return headers;
}
 
Example #8
Source File: RuntimeModeler.java    From hottub with GNU General Public License v2.0 5 votes vote down vote up
private WSDLPart getPart(QName opName, String partName, Mode mode){
    if(binding != null){
        WSDLBoundOperation bo = binding.getBinding().get(opName);
        if(bo != null)
            return bo.getPart(partName, mode);
    }
    return null;
}
 
Example #9
Source File: WebParamHolder.java    From netbeans with Apache License 2.0 5 votes vote down vote up
protected ErrorDescription[] apply(VariableElement subject, ProblemContext ctx) {
    AnnotationMirror paramAnn = Utilities.findAnnotation(subject, ANNOTATION_WEBPARAM);
    if(paramAnn!=null) {
        AnnotationValue val = Utilities.getAnnotationAttrValue(paramAnn, ANNOTATION_ATTRIBUTE_MODE);
        Mode value = null;
        if(val!=null) {
            try {
                value = Mode.valueOf(val.getValue().toString());
            } catch (Exception e) {
                // we dont need to worry as hints for invalid enum value kicks in.
            }
        }
        if((Mode.INOUT == value || Mode.OUT == value) && 
                !"javax.xml.ws.Holder".equals(getVariableType(subject))) {
            String label = NbBundle.getMessage(WebParamHolder.class, "MSG_WebParam_HolderRequired");
            
            Fix fix = new RemoveAnnotationArgument(ctx.getFileObject(),
                    subject, paramAnn, ANNOTATION_ATTRIBUTE_MODE);
            AnnotationTree annotationTree = (AnnotationTree) ctx.getCompilationInfo().
                    getTrees().getTree(subject, paramAnn);
            Tree problemTree = Utilities.getAnnotationArgumentTree(annotationTree, ANNOTATION_ATTRIBUTE_MODE);
            ctx.setElementToAnnotate(problemTree);
            ErrorDescription problem = createProblem(subject, ctx, label, fix);
            ctx.setElementToAnnotate(null);
            return new ErrorDescription[]{problem};
        }
    }
    return null;
}
 
Example #10
Source File: WSDLBoundOperationImpl.java    From openjdk-8-source with GNU General Public License v2.0 5 votes vote down vote up
@Override
public EditableWSDLPart getPart(String partName, Mode mode) {
    if(mode==Mode.IN){
        return inParts.get(partName);
    }else if(mode==Mode.OUT){
        return outParts.get(partName);
    }
    return null;
}
 
Example #11
Source File: ParameterImpl.java    From openjdk-jdk8u-backup with GNU General Public License v2.0 5 votes vote down vote up
public ParameterImpl(JavaMethodImpl parent, TypeInfo type, Mode mode, int index) {
    assert type != null;

    this.typeInfo = type;
    this.name = type.tagName;
    this.mode = mode;
    this.index = index;
    this.parent = parent;
}
 
Example #12
Source File: RuntimeModeler.java    From openjdk-jdk8u with GNU General Public License v2.0 5 votes vote down vote up
private WSDLPart getPart(QName opName, String partName, Mode mode){
    if(binding != null){
        WSDLBoundOperation bo = binding.getBinding().get(opName);
        if(bo != null)
            return bo.getPart(partName, mode);
    }
    return null;
}
 
Example #13
Source File: RuntimeModeler.java    From openjdk-jdk9 with GNU General Public License v2.0 5 votes vote down vote up
private ParameterBinding getBinding(String operation, String part, boolean isHeader, Mode mode){
    if(binding == null){
        if(isHeader)
            return ParameterBinding.HEADER;
        else
            return ParameterBinding.BODY;
    }
    QName opName = new QName(binding.getBinding().getPortType().getName().getNamespaceURI(), operation);
    return binding.getBinding().getBinding(opName, part, mode);
}
 
Example #14
Source File: WSDLBoundOperationImpl.java    From hottub with GNU General Public License v2.0 5 votes vote down vote up
@Override
public EditableWSDLPart getPart(String partName, Mode mode) {
    if(mode==Mode.IN){
        return inParts.get(partName);
    }else if(mode==Mode.OUT){
        return outParts.get(partName);
    }
    return null;
}
 
Example #15
Source File: JAnnotationTest.java    From cxf with Apache License 2.0 5 votes vote down vote up
@Test
public void testPrimitive() {
    JAnnotation annotation = new JAnnotation(WebParam.class);
    annotation.addElement(new JAnnotationElement("header", true, true));
    annotation.addElement(new JAnnotationElement("mode", Mode.INOUT));
    assertEquals("@WebParam(header = true, mode = WebParam.Mode.INOUT)", annotation.toString());
}
 
Example #16
Source File: ParameterImpl.java    From openjdk-8 with GNU General Public License v2.0 5 votes vote down vote up
public ParameterImpl(JavaMethodImpl parent, TypeInfo type, Mode mode, int index) {
    assert type != null;

    this.typeInfo = type;
    this.name = type.tagName;
    this.mode = mode;
    this.index = index;
    this.parent = parent;
}
 
Example #17
Source File: SOAPSEIModel.java    From openjdk-8-source with GNU General Public License v2.0 5 votes vote down vote up
/**
 * @param params
 * @param headers
 */
private void fillHeaders(Iterator<ParameterImpl> params, Set<QName> headers, Mode mode) {
    while (params.hasNext()) {
        ParameterImpl param = params.next();
        ParameterBinding binding = (mode == Mode.IN)?param.getInBinding():param.getOutBinding();
        QName name = param.getName();
        if (binding.isHeader() && !headers.contains(name)) {
            headers.add(name);
        }
    }
}
 
Example #18
Source File: RuntimeModeler.java    From openjdk-jdk8u with GNU General Public License v2.0 5 votes vote down vote up
private ParameterBinding getBinding(String operation, String part, boolean isHeader, Mode mode){
    if(binding == null){
        if(isHeader)
            return ParameterBinding.HEADER;
        else
            return ParameterBinding.BODY;
    }
    QName opName = new QName(binding.getBinding().getPortType().getName().getNamespaceURI(), operation);
    return binding.getBinding().getBinding(opName, part, mode);
}
 
Example #19
Source File: SOAPSEIModel.java    From openjdk-8-source with GNU General Public License v2.0 5 votes vote down vote up
public Set<QName> getKnownHeaders() {
    Set<QName> headers = new HashSet<QName>();
    for (JavaMethodImpl method : getJavaMethods()) {
        // fill in request headers
        Iterator<ParameterImpl> params = method.getRequestParameters().iterator();
        fillHeaders(params, headers, Mode.IN);

        // fill in response headers
        params = method.getResponseParameters().iterator();
        fillHeaders(params, headers, Mode.OUT);
    }
    return headers;
}
 
Example #20
Source File: WSDLBoundPortTypeImpl.java    From openjdk-jdk9 with GNU General Public License v2.0 5 votes vote down vote up
/**
 * Gets the {@link ParameterBinding} for a given operation, part name and the direction - IN/OUT
 *
 * @param operation wsdl:operation@name value. Must be non-null.
 * @param part      wsdl:part@name such as value of soap:header@part. Must be non-null.
 * @param mode      {@link Mode#IN} or {@link Mode#OUT}. Must be non-null.
 * @return null if the binding could not be resolved for the part.
 */
public ParameterBinding getBinding(QName operation, String part, Mode mode) {
    EditableWSDLBoundOperation op = get(operation);
    if (op == null) {
        //TODO throw exception
        return null;
    }
    if ((Mode.IN == mode) || (Mode.INOUT == mode))
        return op.getInputBinding(part);
    else
        return op.getOutputBinding(part);
}
 
Example #21
Source File: RuntimeModeler.java    From jdk8u60 with GNU General Public License v2.0 5 votes vote down vote up
private ParameterBinding getBinding(String operation, String part, boolean isHeader, Mode mode){
    if(binding == null){
        if(isHeader)
            return ParameterBinding.HEADER;
        else
            return ParameterBinding.BODY;
    }
    QName opName = new QName(binding.getBinding().getPortType().getName().getNamespaceURI(), operation);
    return binding.getBinding().getBinding(opName, part, mode);
}
 
Example #22
Source File: RuntimeModeler.java    From jdk8u60 with GNU General Public License v2.0 5 votes vote down vote up
private WSDLPart getPart(QName opName, String partName, Mode mode){
    if(binding != null){
        WSDLBoundOperation bo = binding.getBinding().get(opName);
        if(bo != null)
            return bo.getPart(partName, mode);
    }
    return null;
}
 
Example #23
Source File: SOAPSEIModel.java    From openjdk-8 with GNU General Public License v2.0 5 votes vote down vote up
public Set<QName> getKnownHeaders() {
    Set<QName> headers = new HashSet<QName>();
    for (JavaMethodImpl method : getJavaMethods()) {
        // fill in request headers
        Iterator<ParameterImpl> params = method.getRequestParameters().iterator();
        fillHeaders(params, headers, Mode.IN);

        // fill in response headers
        params = method.getResponseParameters().iterator();
        fillHeaders(params, headers, Mode.OUT);
    }
    return headers;
}
 
Example #24
Source File: SOAPSEIModel.java    From jdk8u60 with GNU General Public License v2.0 5 votes vote down vote up
/**
 * @param params
 * @param headers
 */
private void fillHeaders(Iterator<ParameterImpl> params, Set<QName> headers, Mode mode) {
    while (params.hasNext()) {
        ParameterImpl param = params.next();
        ParameterBinding binding = (mode == Mode.IN)?param.getInBinding():param.getOutBinding();
        QName name = param.getName();
        if (binding.isHeader() && !headers.contains(name)) {
            headers.add(name);
        }
    }
}
 
Example #25
Source File: WSDLBoundPortTypeImpl.java    From openjdk-8 with GNU General Public License v2.0 5 votes vote down vote up
/**
 * Gets the {@link ParameterBinding} for a given operation, part name and the direction - IN/OUT
 *
 * @param operation wsdl:operation@name value. Must be non-null.
 * @param part      wsdl:part@name such as value of soap:header@part. Must be non-null.
 * @param mode      {@link Mode#IN} or {@link Mode#OUT}. Must be non-null.
 * @return null if the binding could not be resolved for the part.
 */
public ParameterBinding getBinding(QName operation, String part, Mode mode) {
    EditableWSDLBoundOperation op = get(operation);
    if (op == null) {
        //TODO throw exception
        return null;
    }
    if ((Mode.IN == mode) || (Mode.INOUT == mode))
        return op.getInputBinding(part);
    else
        return op.getOutputBinding(part);
}
 
Example #26
Source File: WSDLBoundPortTypeImpl.java    From openjdk-8-source with GNU General Public License v2.0 5 votes vote down vote up
/**
 * Gets the {@link ParameterBinding} for a given operation, part name and the direction - IN/OUT
 *
 * @param operation wsdl:operation@name value. Must be non-null.
 * @param part      wsdl:part@name such as value of soap:header@part. Must be non-null.
 * @param mode      {@link Mode#IN} or {@link Mode#OUT}. Must be non-null.
 * @return null if the binding could not be resolved for the part.
 */
public ParameterBinding getBinding(QName operation, String part, Mode mode) {
    EditableWSDLBoundOperation op = get(operation);
    if (op == null) {
        //TODO throw exception
        return null;
    }
    if ((Mode.IN == mode) || (Mode.INOUT == mode))
        return op.getInputBinding(part);
    else
        return op.getOutputBinding(part);
}
 
Example #27
Source File: MessagePart.java    From hottub with GNU General Public License v2.0 4 votes vote down vote up
public boolean isIN(){
    if(mode!=null)
        return (mode == Mode.IN);
    return false;
}
 
Example #28
Source File: MessagePart.java    From openjdk-8 with GNU General Public License v2.0 4 votes vote down vote up
public boolean isINOUT(){
    if(mode!=null)
        return (mode == Mode.INOUT);
    return false;
}
 
Example #29
Source File: ParameterImpl.java    From hottub with GNU General Public License v2.0 4 votes vote down vote up
public boolean isINOUT() {
    return mode==Mode.INOUT;
}
 
Example #30
Source File: WSDLBoundOperationImpl.java    From openjdk-jdk8u-backup with GNU General Public License v2.0 4 votes vote down vote up
public void addPart(EditableWSDLPart part, Mode mode){
    if(mode==Mode.IN)
        inParts.put(part.getName(), part);
    else if(mode==Mode.OUT)
        outParts.put(part.getName(), part);
}