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

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


        String rawName = jField.getRawName();
        boolean hasEl = false;
        for (Annotation ann : jField.getJaxbAnnotaions()) {
            if (ann instanceof XmlMimeType) {
                JAnnotation mimeAnno = new JAnnotation(XmlMimeType.class);
                mimeAnno.addElement(new JAnnotationElement("value", ((XmlMimeType)ann).value()));
                jField.addAnnotation(mimeAnno);
            } else if (ann instanceof XmlJavaTypeAdapter) {          
                JAnnotation jaxbAnn = new JAnnotation(XmlJavaTypeAdapter.class);
                jaxbAnn.addElement(new JAnnotationElement("value", ((XmlJavaTypeAdapter)ann).value()));
                jaxbAnn.addElement(new JAnnotationElement("type", ((XmlJavaTypeAdapter)ann).type()));
                jField.addAnnotation(jaxbAnn);
            } else if (ann instanceof XmlAttachmentRef) {
                JAnnotation jaxbAnn = new JAnnotation(XmlAttachmentRef.class);
                jField.addAnnotation(jaxbAnn);
            } else if (ann instanceof XmlList) {
                JAnnotation jaxbAnn = new JAnnotation(XmlList.class);
                jField.addAnnotation(jaxbAnn);
            } else if (ann instanceof XmlElement) {
                hasEl = true;
                XmlElement el = (XmlElement)ann;
                JAnnotation xmlElementAnnotation = new JAnnotation(XmlElement.class);
                xmlElementAnnotation.addElement(new JAnnotationElement("name", el.name()));
                if (!StringUtils.isEmpty(el.namespace())) {
                    xmlElementAnnotation.addElement(new JAnnotationElement("namespace",
                                                                           el.namespace()));
                }
                if (el.nillable()) {
                    xmlElementAnnotation.addElement(new JAnnotationElement("nillable",
                                                                           el.nillable(), true));
                }
                if (el.required()) {
                    xmlElementAnnotation.addElement(new JAnnotationElement("required",
                                                                           el.required(), true));
                }
                if (!StringUtils.isEmpty(el.defaultValue())) {
                    xmlElementAnnotation.addElement(new JAnnotationElement("defaultValue",
                                                                           el.defaultValue()));
                }
                jField.addAnnotation(xmlElementAnnotation);
            }
        }
        if (!hasEl) {
            JAnnotation xmlElementAnnotation = new JAnnotation(XmlElement.class);
            xmlElementAnnotation.addElement(new JAnnotationElement("name", rawName));
            if (!StringUtils.isEmpty(jField.getTargetNamespace())) {
                xmlElementAnnotation.addElement(new JAnnotationElement("namespace",
                                                                              jField.getTargetNamespace()));
            }

            jField.addAnnotation(xmlElementAnnotation);
        }
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.