Examples of JAnnotation


Examples of org.apache.cxf.tools.common.model.JAnnotation

    public void testAnnotateDOCBare() throws Exception {
        init(method, parameter, SOAPBinding.Style.DOCUMENT, false);

        parameter.annotate(new WebParamAnnotator());

        JAnnotation annotation = parameter.getAnnotation("WebParam");
        assertEquals("@WebParam(partName = \"y\", name = \"x\", "
                     + "targetNamespace = \"http://apache.org/cxf\")",
                         annotation.toString());
        List<JAnnotationElement> elements = annotation.getElements();
        assertEquals(3, elements.size());
        // XXX - order that attributes are appended to the string
        //       differs with the ibmjdk...
        //assertEquals(
        //"@WebParam(targetNamespace = \"http://apache.org/cxf\", partName = \"y\", name = \"x\")",
View Full Code Here

Examples of org.apache.cxf.tools.common.model.JAnnotation

    @Test
    public void testAnnotateRPC() throws Exception {
        init(method, parameter, SOAPBinding.Style.RPC, true);
        parameter.annotate(new WebParamAnnotator());
        JAnnotation annotation = parameter.getAnnotation("WebParam");
        assertEquals(2, annotation.getElements().size());
        assertEquals("@WebParam(partName = \"y\", name = \"y\")",
                     annotation.toString());
    }
View Full Code Here

Examples of org.apache.cxf.tools.common.model.JAnnotation

        method.annotate(new WebResultAnnotator());
        Map<String, JAnnotation> annotations = method.getAnnotationMap();
        assertNotNull(annotations);
        assertEquals(1, annotations.size());
        assertEquals("WebResult", annotations.keySet().iterator().next());
        JAnnotation resultAnnotation = annotations.get("WebResult");
        assertEquals("@WebResult(name = \"return\")", resultAnnotation.toString());
        List<JAnnotationElement> elements = resultAnnotation.getElements();
        assertNotNull(elements);
        assertEquals(1, elements.size());
        assertEquals("name", elements.get(0).getName());
        assertEquals("return", elements.get(0).getValue());
    }
View Full Code Here

Examples of org.apache.cxf.tools.common.model.JAnnotation

                } else {
                    processor.processMethod(jm, bop.getOperationInfo());
                }

                if (headerType == this.resultHeader) {
                    JAnnotation resultAnno = jm.getAnnotationMap().get("WebResult");
                    if (resultAnno != null) {
                        resultAnno.addElement(new JAnnotationElement("header", true, true));
                    }
                }
                processParameter(jm, bop);
            }
        }
View Full Code Here

Examples of org.apache.cxf.tools.common.model.JAnnotation

        }
    }

    private void setParameterAsHeader(JavaParameter parameter) {
        parameter.setHeader(true);
        JAnnotation parameterAnnotation = parameter.getAnnotation("WebParam");
        parameterAnnotation.addElement(new JAnnotationElement("header", true, true));
        parameterAnnotation.addElement(new JAnnotationElement("name",
                                                                     parameter.getQName().getLocalPart()));
        parameterAnnotation.addElement(new JAnnotationElement("partName", parameter.getPartName()));
        parameterAnnotation.addElement(new JAnnotationElement("targetNamespace",
                                                                     parameter.getTargetNamespace()));
    }
View Full Code Here

Examples of org.apache.cxf.tools.common.model.JAnnotation

                        p2.setName(param.getName());
                        p2.setClassName(param.getHolderName());
                        p2.setStyle(JavaType.Style.IN);
                        callbackMethod.addParameter(p2);
                        for (String s : param.getAnnotationTags()) {
                            JAnnotation ann = param.getAnnotation(s);
                            p2.addAnnotation(s, ann);
                        }
                    } else if (!param.isHeader() && asyncCname == null) {
                        asyncCname = param.getClassName();
                    }
                } else {
                    callbackMethod.addParameter(param);
                }
            } else {
                callbackMethod.addParameter(param);
            }
        }
        JavaParameter asyncHandler = new JavaParameter();
       
        asyncHandler.setName("asyncHandler");
        asyncHandler.setCallback(true);
        asyncHandler.setClassName(getAsyncClassName(method,
                                                    "AsyncHandler",
                                                    asyncCname));
        asyncHandler.setStyle(JavaType.Style.IN);
       
        callbackMethod.addParameter(asyncHandler);
       
        JAnnotation asyncHandlerAnnotation = new JAnnotation(WebParam.class);
        asyncHandlerAnnotation.addElement(new JAnnotationElement("name", "asyncHandler"));
        asyncHandlerAnnotation.addElement(new JAnnotationElement("targetNamespace", ""));
        asyncHandler.addAnnotation("WebParam", asyncHandlerAnnotation);               

        method.getInterface().addImport("javax.jws.WebParam");
        method.getInterface().addMethod(callbackMethod);
    }
View Full Code Here

Examples of org.apache.cxf.tools.common.model.JAnnotation

                        p2.setName(param.getName());
                        p2.setClassName(param.getHolderName());
                        p2.setStyle(JavaType.Style.IN);
                        pollingMethod.addParameter(p2);
                        for (String s : param.getAnnotationTags()) {
                            JAnnotation ann = param.getAnnotation(s);
                            p2.addAnnotation(s, ann);
                        }
                    } else if (!param.isHeader() && asyncCname == null) {
                        asyncCname = param.getClassName();
                    }
View Full Code Here

Examples of org.apache.cxf.tools.common.model.JAnnotation

                    // REVISIT: find a better way to handle Handler gen, should not
                    // pass JavaInterface around.
                    handlerGen.setJavaInterface(intf);
                    handlerGen.generate(getEnvironment());
   
                    JAnnotation annot = handlerGen.getHandlerAnnotation();
                    if (handlerGen.getHandlerAnnotation() != null) {
                        boolean existHandlerAnno = false;
                        for (JAnnotation jann : intf.getAnnotations()) {
                            if (jann.getType() == HandlerChain.class) {
                                existHandlerAnno = true;
                            }
                        }
                        if (!existHandlerAnno) {
                            intf.addAnnotation(annot);
                            intf.addImport("javax.jws.HandlerChain");
                        }
                    }
                }
                if (penv.containsKey(ToolConstants.RUNTIME_DATABINDING_CLASS)) {
                    JAnnotation ann = new JAnnotation(DataBinding.class);
                    JAnnotationElement el
                        = new JAnnotationElement(null,
                                                 penv.get(ToolConstants.RUNTIME_DATABINDING_CLASS),
                                                 true);
                    ann.addElement(el);
                    intf.addAnnotation(ann);
                }
                clearAttributes();
                setAttributes("intf", intf);
                setCommonAttributes();
View Full Code Here

Examples of org.apache.cxf.tools.common.model.JAnnotation

                if (js.getHandlerChains() != null) {
                    HandlerConfigGenerator handlerGen = new HandlerConfigGenerator();
                    handlerGen.setJavaInterface(js);
                    handlerGen.generate(getEnvironment());
   
                    JAnnotation annot = handlerGen.getHandlerAnnotation();
                                  
                    if (handlerGen.getHandlerAnnotation() != null) {
                        boolean existHandlerAnno = false;
                        for (JAnnotation jann : js.getAnnotations()) {
                            if (jann.getType() == HandlerChain.class) {
View Full Code Here

Examples of org.apache.cxf.tools.common.model.JAnnotation

        JavaInterface intf = method.getInterface();
        MessageInfo inputMessage = operation.getInput();
        MessageInfo outputMessage = operation.getOutput();

        JAnnotation actionAnnotation = new JAnnotation(Action.class);
        if (inputMessage.getExtensionAttributes() != null) {
            String inputAction = getAction(inputMessage);
            if (inputAction != null) {
                actionAnnotation.addElement(new JAnnotationElement("input",
                                                                   inputAction));
                required = true;
            }
        }

        if (outputMessage != null && outputMessage.getExtensionAttributes() != null) {
            String outputAction = getAction(outputMessage);
            if (outputAction != null) {
                actionAnnotation.addElement(new JAnnotationElement("output",
                                                                   outputAction));
                required = true;
            }
        }
        if (operation.hasFaults()) {
            List<JAnnotation> faultAnnotations = new ArrayList<JAnnotation>();
            for (FaultInfo faultInfo : operation.getFaults()) {
                if (faultInfo.getExtensionAttributes() != null) {
                    String faultAction = getAction(faultInfo);
                    if (faultAction == null) {
                        continue;
                    }

                    JavaException exceptionClass = getExceptionClass(method, faultInfo);                   
                    if (!StringUtils.isEmpty(exceptionClass.getPackageName())
                        && !exceptionClass.getPackageName().equals(intf.getPackageName())) {
                        intf.addImport(exceptionClass.getClassName());
                    }                   

                    JAnnotation faultAnnotation = new JAnnotation(FaultAction.class);
                    faultAnnotation.addElement(new JAnnotationElement("className", exceptionClass));
                    faultAnnotation.addElement(new JAnnotationElement("value",
                                                                      faultAction));
                    faultAnnotations.add(faultAnnotation);
                    required = true;
                }
            }
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.