Package org.apache.cxf.tools.common.model

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


    }

    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("targetNamespace",
                                                                     parameter.getTargetNamespace()));
    }
View Full Code Here


        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.setAnnotation(asyncHandlerAnnotation);               

        method.getInterface().addMethod(callbackMethod);
    }
View Full Code Here

                }

                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

    }

    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

        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

        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;
                }
            }
            actionAnnotation.addElement(new JAnnotationElement("fault", faultAnnotations));
        }

        if (required) {
            method.addAnnotation("Action", actionAnnotation);
        }
View Full Code Here

                types.add(new JavaType(null, "ObjectFactory", null));
            } else {
                types.add(new JavaType(null, pkg + ".ObjectFactory", null));
            }
        }
        jaxbAnnotation.addElement(new JAnnotationElement(null, types));
        intf.addAnnotation(jaxbAnnotation);
    }
View Full Code Here

    }

    public void annotate(JavaAnnotatable jn) {

        JAnnotation jaxbAnnotation = new JAnnotation(XmlJavaTypeAdapter.class);
        jaxbAnnotation.addElement(new JAnnotationElement("value", adapter));
        if (jn instanceof JavaParameter) {
            JavaParameter jp = (JavaParameter)jn;
            jp.addAnnotation("XmlJavaTypeAdapter", jaxbAnnotation);
        } else if (jn instanceof JavaMethod) {
            JavaMethod jm = (JavaMethod)jn;
View Full Code Here

                        }
                    }
                }
                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);
                }
View Full Code Here

        } else {
            throw new RuntimeException("WrapperBeanAnnotator expect JavaClass as input");
        }

        JAnnotation xmlRootElement = new JAnnotation(XmlRootElement.class);
        xmlRootElement.addElement(new JAnnotationElement("name",
                                                         beanClass.getElementName().getLocalPart()));
        xmlRootElement.addElement(new JAnnotationElement("namespace",
                                                         beanClass.getElementName().getNamespaceURI()));
       
        JAnnotation xmlAccessorType = new JAnnotation(XmlAccessorType.class);
        xmlAccessorType.addElement(new JAnnotationElement(null, XmlAccessType.FIELD));

        XmlType tp = null;
        if (sourceClass != null) {
            tp = sourceClass.getAnnotation(XmlType.class);
        }
        JAnnotation xmlType = new JAnnotation(XmlType.class);
        if (tp == null) {
            xmlType.addElement(new JAnnotationElement("name",
                                                  beanClass.getElementName().getLocalPart()));
            xmlType.addElement(new JAnnotationElement("namespace",
                                                  beanClass.getElementName().getNamespaceURI()));
        } else {
            if (!"##default".equals(tp.name())) {
                xmlType.addElement(new JAnnotationElement("name",
                                                          tp.name()));
            }
            if (!"##default".equals(tp.namespace())) {
                xmlType.addElement(new JAnnotationElement("namespace",
                                                          tp.namespace()));
            }
            if (!StringUtils.isEmpty(tp.factoryMethod())) {
                xmlType.addElement(new JAnnotationElement("factoryMethod",
                                                          tp.factoryMethod()));
            }
            if (tp.propOrder().length != 1
                || !StringUtils.isEmpty(tp.propOrder()[0])) {
                xmlType.addElement(new JAnnotationElement("propOrder",
                                                      tp.propOrder()));
            }
           
        }
        List<String> props = new ArrayList<String>();
        for (JavaField f : beanClass.getFields()) {
            props.add(f.getParaName());
        }
        if (props.size() > 1) {
            xmlType.addElement(new JAnnotationElement("propOrder",
                                                      props));
        }
       
        // Revisit: why annotation is string?
        beanClass.addAnnotation(xmlRootElement);
View Full Code Here

TOP

Related Classes of org.apache.cxf.tools.common.model.JAnnotationElement

Copyright © 2018 www.massapicom. 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.