private void addWSDLExtension()

in wsdlextension/src/main/java/org/apache/cxf/xjc/wsdlextension/WSDLExtension.java [76:104]


    private void addWSDLExtension(ClassOutline co) {
        final JDefinedClass implementation = co.implClass;
        implementation._implements(ExtensibilityElement.class);

        JFieldVar elementTypeVar = implementation.field(JMod.PROTECTED, QName.class, "elementType");
        elementTypeVar.annotate(XmlTransient.class);

        JFieldVar requiredVar = implementation.field(JMod.PROTECTED, Boolean.class, "required");
        JAnnotationUse requiredAnnotation = requiredVar.annotate(XmlAttribute.class);
        requiredAnnotation.param("namespace", "http://schemas.xmlsoap.org/wsdl/");

        JMethod getElementTypeMethod = implementation.method(JMod.PUBLIC, QName.class,
                                                             "getElementType");
        getElementTypeMethod.body()._return(JExpr.direct("elementType"));

        JMethod setElementTypeMethod = implementation.method(JMod.PUBLIC, JType.parse(co
            .parent().getCodeModel(), "void"), "setElementType");
        setElementTypeMethod.param(QName.class, "type");
        setElementTypeMethod.body().directStatement("this.elementType = type;");

        JMethod getRequiredMethod = implementation.method(JMod.PUBLIC, Boolean.class,
                                                             "getRequired");
        getRequiredMethod.body()._return(JExpr.direct("required == null ? false : required"));

        JMethod setRequiredMethod = implementation.method(JMod.PUBLIC, JType.parse(co
            .parent().getCodeModel(), "void"), "setRequired");
        setRequiredMethod.param(Boolean.class, "required");
        setRequiredMethod.body().directStatement("this.required = required;");
    }