Java 类com.sun.codemodel.internal.JAnnotationUse 实例源码

项目:OpenJSharp    文件:ServiceGenerator.java   
private void writeWebServiceClientAnnotation(Service service, JAnnotationUse wsa) {
    String serviceName = service.getName().getLocalPart();
    String serviceNS = service.getName().getNamespaceURI();
    wsa.param("name", serviceName);
    wsa.param("targetNamespace", serviceNS);
    wsa.param("wsdlLocation", wsdlLocation);
}
项目:OpenJSharp    文件:GeneratorBase.java   
protected void writeHandlerConfig(String className, JDefinedClass cls, WsimportOptions options) {
    Element e = options.getHandlerChainConfiguration();
    if (e == null) {
        return;
    }
    JAnnotationUse handlerChainAnn = cls.annotate(cm.ref(HandlerChain.class));
    NodeList nl = e.getElementsByTagNameNS(
        "http://java.sun.com/xml/ns/javaee", "handler-chain");
    if(nl.getLength() > 0){
        String fName = getHandlerConfigFileName(className);
        handlerChainAnn.param("file", fName);
        generateHandlerChainFile(e, className);
    }
}
项目:OpenJSharp    文件:WebServiceWrapperGenerator.java   
private void writeXmlElementDeclaration(JDefinedClass cls, String elementName, String namespaceUri) {

       if (cls == null)
            return;
        JAnnotationUse xmlRootElementAnn = cls.annotate(XmlRootElement.class);
        xmlRootElementAnn.param("name", elementName);
        if (namespaceUri.length() > 0) {
            xmlRootElementAnn.param("namespace", namespaceUri);
        }
        JAnnotationUse xmlAccessorTypeAnn = cls.annotate(cm.ref(XmlAccessorType.class));
        xmlAccessorTypeAnn.param("value", XmlAccessType.FIELD);
    }
项目:OpenJSharp    文件:WebServiceWrapperGenerator.java   
private void writeXmlTypeDeclaration(JDefinedClass cls, String typeName, String namespaceUri,
                                     Collection<MemberInfo> members) {
    if (cls == null)
        return;
    JAnnotationUse xmlTypeAnn = cls.annotate(cm.ref(XmlType.class));
    xmlTypeAnn.param("name", typeName);
    xmlTypeAnn.param("namespace", namespaceUri);
    if (members.size() > 1) {
        JAnnotationArrayMember paramArray = xmlTypeAnn.paramArray("propOrder");
        for (MemberInfo memInfo : members) {
            paramArray.param(memInfo.getParamName());
        }
    }
}
项目:openjdk-jdk10    文件:ServiceGenerator.java   
private void writeWebServiceClientAnnotation(Service service, JAnnotationUse wsa) {
    String serviceName = service.getName().getLocalPart();
    String serviceNS = service.getName().getNamespaceURI();
    wsa.param("name", serviceName);
    wsa.param("targetNamespace", serviceNS);
    wsa.param("wsdlLocation", wsdlLocation);
}
项目:openjdk-jdk10    文件:GeneratorBase.java   
protected void writeHandlerConfig(String className, JDefinedClass cls, WsimportOptions options) {
    Element e = options.getHandlerChainConfiguration();
    if (e == null) {
        return;
    }
    JAnnotationUse handlerChainAnn = cls.annotate(cm.ref(HandlerChain.class));
    NodeList nl = e.getElementsByTagNameNS(
        "http://java.sun.com/xml/ns/javaee", "handler-chain");
    if(nl.getLength() > 0){
        String fName = getHandlerConfigFileName(className);
        handlerChainAnn.param("file", fName);
        generateHandlerChainFile(e, className);
    }
}
项目:openjdk-jdk10    文件:WebServiceWrapperGenerator.java   
private void writeXmlElementDeclaration(JDefinedClass cls, String elementName, String namespaceUri) {

       if (cls == null)
            return;
        JAnnotationUse xmlRootElementAnn = cls.annotate(XmlRootElement.class);
        xmlRootElementAnn.param("name", elementName);
        if (namespaceUri.length() > 0) {
            xmlRootElementAnn.param("namespace", namespaceUri);
        }
        JAnnotationUse xmlAccessorTypeAnn = cls.annotate(cm.ref(XmlAccessorType.class));
        xmlAccessorTypeAnn.param("value", XmlAccessType.FIELD);
    }
项目:openjdk-jdk10    文件:WebServiceWrapperGenerator.java   
private void writeXmlTypeDeclaration(JDefinedClass cls, String typeName, String namespaceUri,
                                     Collection<MemberInfo> members) {
    if (cls == null)
        return;
    JAnnotationUse xmlTypeAnn = cls.annotate(cm.ref(XmlType.class));
    xmlTypeAnn.param("name", typeName);
    xmlTypeAnn.param("namespace", namespaceUri);
    if (members.size() > 1) {
        JAnnotationArrayMember paramArray = xmlTypeAnn.paramArray("propOrder");
        for (MemberInfo memInfo : members) {
            paramArray.param(memInfo.getParamName());
        }
    }
}
项目:openjdk9    文件:ServiceGenerator.java   
private void writeWebServiceClientAnnotation(Service service, JAnnotationUse wsa) {
    String serviceName = service.getName().getLocalPart();
    String serviceNS = service.getName().getNamespaceURI();
    wsa.param("name", serviceName);
    wsa.param("targetNamespace", serviceNS);
    wsa.param("wsdlLocation", wsdlLocation);
}
项目:openjdk9    文件:GeneratorBase.java   
protected void writeHandlerConfig(String className, JDefinedClass cls, WsimportOptions options) {
    Element e = options.getHandlerChainConfiguration();
    if (e == null) {
        return;
    }
    JAnnotationUse handlerChainAnn = cls.annotate(cm.ref(HandlerChain.class));
    NodeList nl = e.getElementsByTagNameNS(
        "http://java.sun.com/xml/ns/javaee", "handler-chain");
    if(nl.getLength() > 0){
        String fName = getHandlerConfigFileName(className);
        handlerChainAnn.param("file", fName);
        generateHandlerChainFile(e, className);
    }
}
项目:openjdk9    文件:WebServiceWrapperGenerator.java   
private void writeXmlElementDeclaration(JDefinedClass cls, String elementName, String namespaceUri) {

       if (cls == null)
            return;
        JAnnotationUse xmlRootElementAnn = cls.annotate(XmlRootElement.class);
        xmlRootElementAnn.param("name", elementName);
        if (namespaceUri.length() > 0) {
            xmlRootElementAnn.param("namespace", namespaceUri);
        }
        JAnnotationUse xmlAccessorTypeAnn = cls.annotate(cm.ref(XmlAccessorType.class));
        xmlAccessorTypeAnn.param("value", XmlAccessType.FIELD);
    }
项目:openjdk9    文件:WebServiceWrapperGenerator.java   
private void writeXmlTypeDeclaration(JDefinedClass cls, String typeName, String namespaceUri,
                                     Collection<MemberInfo> members) {
    if (cls == null)
        return;
    JAnnotationUse xmlTypeAnn = cls.annotate(cm.ref(XmlType.class));
    xmlTypeAnn.param("name", typeName);
    xmlTypeAnn.param("namespace", namespaceUri);
    if (members.size() > 1) {
        JAnnotationArrayMember paramArray = xmlTypeAnn.paramArray("propOrder");
        for (MemberInfo memInfo : members) {
            paramArray.param(memInfo.getParamName());
        }
    }
}
项目:lookaside_java-1.8.0-openjdk    文件:ServiceGenerator.java   
private void writeWebServiceClientAnnotation(Service service, JAnnotationUse wsa) {
    String serviceName = service.getName().getLocalPart();
    String serviceNS = service.getName().getNamespaceURI();
    wsa.param("name", serviceName);
    wsa.param("targetNamespace", serviceNS);
    wsa.param("wsdlLocation", wsdlLocation);
}
项目:lookaside_java-1.8.0-openjdk    文件:GeneratorBase.java   
protected void writeHandlerConfig(String className, JDefinedClass cls, WsimportOptions options) {
    Element e = options.getHandlerChainConfiguration();
    if (e == null) {
        return;
    }
    JAnnotationUse handlerChainAnn = cls.annotate(cm.ref(HandlerChain.class));
    NodeList nl = e.getElementsByTagNameNS(
        "http://java.sun.com/xml/ns/javaee", "handler-chain");
    if(nl.getLength() > 0){
        String fName = getHandlerConfigFileName(className);
        handlerChainAnn.param("file", fName);
        generateHandlerChainFile(e, className);
    }
}
项目:lookaside_java-1.8.0-openjdk    文件:WebServiceWrapperGenerator.java   
private void writeXmlElementDeclaration(JDefinedClass cls, String elementName, String namespaceUri) {

       if (cls == null)
            return;
        JAnnotationUse xmlRootElementAnn = cls.annotate(XmlRootElement.class);
        xmlRootElementAnn.param("name", elementName);
        if (namespaceUri.length() > 0) {
            xmlRootElementAnn.param("namespace", namespaceUri);
        }
        JAnnotationUse xmlAccessorTypeAnn = cls.annotate(cm.ref(XmlAccessorType.class));
        xmlAccessorTypeAnn.param("value", XmlAccessType.FIELD);
    }
项目:lookaside_java-1.8.0-openjdk    文件:WebServiceWrapperGenerator.java   
private void writeXmlTypeDeclaration(JDefinedClass cls, String typeName, String namespaceUri,
                                     Collection<MemberInfo> members) {
    if (cls == null)
        return;
    JAnnotationUse xmlTypeAnn = cls.annotate(cm.ref(XmlType.class));
    xmlTypeAnn.param("name", typeName);
    xmlTypeAnn.param("namespace", namespaceUri);
    if (members.size() > 1) {
        JAnnotationArrayMember paramArray = xmlTypeAnn.paramArray("propOrder");
        for (MemberInfo memInfo : members) {
            paramArray.param(memInfo.getParamName());
        }
    }
}
项目:infobip-open-jdk-8    文件:ServiceGenerator.java   
private void writeWebServiceClientAnnotation(Service service, JAnnotationUse wsa) {
    String serviceName = service.getName().getLocalPart();
    String serviceNS = service.getName().getNamespaceURI();
    wsa.param("name", serviceName);
    wsa.param("targetNamespace", serviceNS);
    wsa.param("wsdlLocation", wsdlLocation);
}
项目:infobip-open-jdk-8    文件:GeneratorBase.java   
protected void writeHandlerConfig(String className, JDefinedClass cls, WsimportOptions options) {
    Element e = options.getHandlerChainConfiguration();
    if (e == null) {
        return;
    }
    JAnnotationUse handlerChainAnn = cls.annotate(cm.ref(HandlerChain.class));
    NodeList nl = e.getElementsByTagNameNS(
        "http://java.sun.com/xml/ns/javaee", "handler-chain");
    if(nl.getLength() > 0){
        String fName = getHandlerConfigFileName(className);
        handlerChainAnn.param("file", fName);
        generateHandlerChainFile(e, className);
    }
}
项目:infobip-open-jdk-8    文件:WebServiceWrapperGenerator.java   
private void writeXmlElementDeclaration(JDefinedClass cls, String elementName, String namespaceUri) {

       if (cls == null)
            return;
        JAnnotationUse xmlRootElementAnn = cls.annotate(XmlRootElement.class);
        xmlRootElementAnn.param("name", elementName);
        if (namespaceUri.length() > 0) {
            xmlRootElementAnn.param("namespace", namespaceUri);
        }
        JAnnotationUse xmlAccessorTypeAnn = cls.annotate(cm.ref(XmlAccessorType.class));
        xmlAccessorTypeAnn.param("value", XmlAccessType.FIELD);
    }
项目:infobip-open-jdk-8    文件:WebServiceWrapperGenerator.java   
private void writeXmlTypeDeclaration(JDefinedClass cls, String typeName, String namespaceUri,
                                     Collection<MemberInfo> members) {
    if (cls == null)
        return;
    JAnnotationUse xmlTypeAnn = cls.annotate(cm.ref(XmlType.class));
    xmlTypeAnn.param("name", typeName);
    xmlTypeAnn.param("namespace", namespaceUri);
    if (members.size() > 1) {
        JAnnotationArrayMember paramArray = xmlTypeAnn.paramArray("propOrder");
        for (MemberInfo memInfo : members) {
            paramArray.param(memInfo.getParamName());
        }
    }
}
项目:OLD-OpenJDK8    文件:ServiceGenerator.java   
private void writeWebServiceClientAnnotation(Service service, JAnnotationUse wsa) {
    String serviceName = service.getName().getLocalPart();
    String serviceNS = service.getName().getNamespaceURI();
    wsa.param("name", serviceName);
    wsa.param("targetNamespace", serviceNS);
    wsa.param("wsdlLocation", wsdlLocation);
}
项目:OLD-OpenJDK8    文件:GeneratorBase.java   
protected void writeHandlerConfig(String className, JDefinedClass cls, WsimportOptions options) {
    Element e = options.getHandlerChainConfiguration();
    if (e == null) {
        return;
    }
    JAnnotationUse handlerChainAnn = cls.annotate(cm.ref(HandlerChain.class));
    NodeList nl = e.getElementsByTagNameNS(
        "http://java.sun.com/xml/ns/javaee", "handler-chain");
    if(nl.getLength() > 0){
        String fName = getHandlerConfigFileName(className);
        handlerChainAnn.param("file", fName);
        generateHandlerChainFile(e, className);
    }
}
项目:OLD-OpenJDK8    文件:WebServiceWrapperGenerator.java   
private void writeXmlElementDeclaration(JDefinedClass cls, String elementName, String namespaceUri) {

       if (cls == null)
            return;
        JAnnotationUse xmlRootElementAnn = cls.annotate(XmlRootElement.class);
        xmlRootElementAnn.param("name", elementName);
        if (namespaceUri.length() > 0) {
            xmlRootElementAnn.param("namespace", namespaceUri);
        }
        JAnnotationUse xmlAccessorTypeAnn = cls.annotate(cm.ref(XmlAccessorType.class));
        xmlAccessorTypeAnn.param("value", XmlAccessType.FIELD);
    }
项目:OLD-OpenJDK8    文件:WebServiceWrapperGenerator.java   
private void writeXmlTypeDeclaration(JDefinedClass cls, String typeName, String namespaceUri,
                                     Collection<MemberInfo> members) {
    if (cls == null)
        return;
    JAnnotationUse xmlTypeAnn = cls.annotate(cm.ref(XmlType.class));
    xmlTypeAnn.param("name", typeName);
    xmlTypeAnn.param("namespace", namespaceUri);
    if (members.size() > 1) {
        JAnnotationArrayMember paramArray = xmlTypeAnn.paramArray("propOrder");
        for (MemberInfo memInfo : members) {
            paramArray.param(memInfo.getParamName());
        }
    }
}
项目:openjdk-icedtea7    文件:ServiceGenerator.java   
private void writeWebServiceClientAnnotation(Service service, JAnnotationUse wsa) {
    String serviceName = service.getName().getLocalPart();
    String serviceNS = service.getName().getNamespaceURI();
    wsa.param("name", serviceName);
    wsa.param("targetNamespace", serviceNS);
    wsa.param("wsdlLocation", wsdlLocation);
}
项目:openjdk-icedtea7    文件:GeneratorBase.java   
protected void writeHandlerConfig(String className, JDefinedClass cls, WsimportOptions options) {
    Element e = options.getHandlerChainConfiguration();
    if(e == null)
        return;
    JAnnotationUse handlerChainAnn = cls.annotate(cm.ref(HandlerChain.class));
    NodeList nl = e.getElementsByTagNameNS(
        "http://java.sun.com/xml/ns/javaee", "handler-chain");
    if(nl.getLength() > 0){
        String fName = getHandlerConfigFileName(className);
        handlerChainAnn.param("file", fName);
        generateHandlerChainFile(e, className);
    }
}
项目:OpenJSharp    文件:CustomExceptionGenerator.java   
private void write(Fault fault) throws JClassAlreadyExistsException {
    String className = Names.customExceptionClassName(fault);

    JDefinedClass cls = cm._class(className, ClassType.CLASS);
    JDocComment comment = cls.javadoc();
    if(fault.getJavaDoc() != null){
        comment.add(fault.getJavaDoc());
        comment.add("\n\n");
    }

    for (String doc : getJAXWSClassComment()) {
        comment.add(doc);
    }

    cls._extends(java.lang.Exception.class);

    //@WebFault
    JAnnotationUse faultAnn = cls.annotate(WebFault.class);
    faultAnn.param("name", fault.getBlock().getName().getLocalPart());
    faultAnn.param("targetNamespace", fault.getBlock().getName().getNamespaceURI());

    JType faultBean = fault.getBlock().getType().getJavaType().getType().getType();

    //faultInfo filed
    JFieldVar fi = cls.field(JMod.PRIVATE, faultBean, "faultInfo");

    //add jaxb annotations
    fault.getBlock().getType().getJavaType().getType().annotate(fi);

    fi.javadoc().add("Java type that goes as soapenv:Fault detail element.");
    JFieldRef fr = JExpr.ref(JExpr._this(), fi);

    //Constructor
    JMethod constrc1 = cls.constructor(JMod.PUBLIC);
    JVar var1 = constrc1.param(String.class, "message");
    JVar var2 = constrc1.param(faultBean, "faultInfo");
    constrc1.javadoc().addParam(var1);
    constrc1.javadoc().addParam(var2);
    JBlock cb1 = constrc1.body();
    cb1.invoke("super").arg(var1);

    cb1.assign(fr, var2);

    //constructor with Throwable
    JMethod constrc2 = cls.constructor(JMod.PUBLIC);
    var1 = constrc2.param(String.class, "message");
    var2 = constrc2.param(faultBean, "faultInfo");
    JVar var3 = constrc2.param(Throwable.class, "cause");
    constrc2.javadoc().addParam(var1);
    constrc2.javadoc().addParam(var2);
    constrc2.javadoc().addParam(var3);
    JBlock cb2 = constrc2.body();
    cb2.invoke("super").arg(var1).arg(var3);
    cb2.assign(fr, var2);


    //getFaultInfo() method
    JMethod fim = cls.method(JMod.PUBLIC, faultBean, "getFaultInfo");
    fim.javadoc().addReturn().add("returns fault bean: "+faultBean.fullName());
    JBlock fib = fim.body();
    fib._return(fi);
    fault.setExceptionClass(cls);

}
项目:OpenJSharp    文件:ServiceGenerator.java   
private void writeWebEndpoint(Port port, JMethod m) {
    JAnnotationUse webEndpointAnn = m.annotate(cm.ref(WebEndpoint.class));
    webEndpointAnn.param("name", port.getName().getLocalPart());
}
项目:OpenJSharp    文件:W3CAddressingJavaGeneratorExtension.java   
@Override
public void writeMethodAnnotations(TWSDLOperation two, JMethod jMethod) {
    JAnnotationUse actionAnn = null;

    if (!(two instanceof Operation))
        return;

    Operation o = ((Operation)two);

    // explicit input action
    if (o.getInput().getAction() != null && !o.getInput().getAction().equals("")) {
        // explicitly specified
        actionAnn = jMethod.annotate(Action.class);
        actionAnn.param("input", o.getInput().getAction());
    }

    // explicit output action
    if (o.getOutput() != null && o.getOutput().getAction() != null && !o.getOutput().getAction().equals("")) {
        // explicitly specified
        if (actionAnn == null)
            actionAnn = jMethod.annotate(Action.class);

        actionAnn.param("output", o.getOutput().getAction());
    }

    // explicit fault action
    if (o.getFaults() != null && o.getFaults().size() > 0) {
        Map<String, JClass> map = o.getFaults();
        JAnnotationArrayMember jam = null;

        for (Fault f : o.faults()) {
            if (f.getAction() == null)
                continue;

            if (f.getAction().equals(""))
                continue;

            if (actionAnn == null) {
                actionAnn = jMethod.annotate(Action.class);
            }
            if (jam == null) {
                jam = actionAnn.paramArray("fault");
            }
            final JAnnotationUse faAnn = jam.annotate(FaultAction.class);
            faAnn.param("className", map.get(f.getName()));
            faAnn.param("value", f.getAction());
        }
    }
}
项目:openjdk-jdk10    文件:CustomExceptionGenerator.java   
private void write(Fault fault) throws JClassAlreadyExistsException {
    String className = Names.customExceptionClassName(fault);

    JDefinedClass cls = cm._class(className, ClassType.CLASS);
    JDocComment comment = cls.javadoc();
    if(fault.getJavaDoc() != null){
        comment.add(fault.getJavaDoc());
        comment.add("\n\n");
    }

    for (String doc : getJAXWSClassComment()) {
        comment.add(doc);
    }

    cls._extends(java.lang.Exception.class);

    //@WebFault
    JAnnotationUse faultAnn = cls.annotate(WebFault.class);
    faultAnn.param("name", fault.getBlock().getName().getLocalPart());
    faultAnn.param("targetNamespace", fault.getBlock().getName().getNamespaceURI());

    JType faultBean = fault.getBlock().getType().getJavaType().getType().getType();

    //faultInfo filed
    JFieldVar fi = cls.field(JMod.PRIVATE, faultBean, "faultInfo");

    //add jaxb annotations
    fault.getBlock().getType().getJavaType().getType().annotate(fi);

    fi.javadoc().add("Java type that goes as soapenv:Fault detail element.");
    JFieldRef fr = JExpr.ref(JExpr._this(), fi);

    //Constructor
    JMethod constrc1 = cls.constructor(JMod.PUBLIC);
    JVar var1 = constrc1.param(String.class, "message");
    JVar var2 = constrc1.param(faultBean, "faultInfo");
    constrc1.javadoc().addParam(var1);
    constrc1.javadoc().addParam(var2);
    JBlock cb1 = constrc1.body();
    cb1.invoke("super").arg(var1);

    cb1.assign(fr, var2);

    //constructor with Throwable
    JMethod constrc2 = cls.constructor(JMod.PUBLIC);
    var1 = constrc2.param(String.class, "message");
    var2 = constrc2.param(faultBean, "faultInfo");
    JVar var3 = constrc2.param(Throwable.class, "cause");
    constrc2.javadoc().addParam(var1);
    constrc2.javadoc().addParam(var2);
    constrc2.javadoc().addParam(var3);
    JBlock cb2 = constrc2.body();
    cb2.invoke("super").arg(var1).arg(var3);
    cb2.assign(fr, var2);


    //getFaultInfo() method
    JMethod fim = cls.method(JMod.PUBLIC, faultBean, "getFaultInfo");
    fim.javadoc().addReturn().add("returns fault bean: "+faultBean.fullName());
    JBlock fib = fim.body();
    fib._return(fi);
    fault.setExceptionClass(cls);

}
项目:openjdk-jdk10    文件:ServiceGenerator.java   
private void writeWebEndpoint(Port port, JMethod m) {
    JAnnotationUse webEndpointAnn = m.annotate(cm.ref(WebEndpoint.class));
    webEndpointAnn.param("name", port.getName().getLocalPart());
}
项目:openjdk-jdk10    文件:W3CAddressingJavaGeneratorExtension.java   
@Override
public void writeMethodAnnotations(TWSDLOperation two, JMethod jMethod) {
    JAnnotationUse actionAnn = null;

    if (!(two instanceof Operation))
        return;

    Operation o = ((Operation)two);

    // explicit input action
    if (o.getInput().getAction() != null && !o.getInput().getAction().equals("")) {
        // explicitly specified
        actionAnn = jMethod.annotate(Action.class);
        actionAnn.param("input", o.getInput().getAction());
    }

    // explicit output action
    if (o.getOutput() != null && o.getOutput().getAction() != null && !o.getOutput().getAction().equals("")) {
        // explicitly specified
        if (actionAnn == null)
            actionAnn = jMethod.annotate(Action.class);

        actionAnn.param("output", o.getOutput().getAction());
    }

    // explicit fault action
    if (o.getFaults() != null && o.getFaults().size() > 0) {
        Map<String, JClass> map = o.getFaults();
        JAnnotationArrayMember jam = null;

        for (Fault f : o.faults()) {
            if (f.getAction() == null)
                continue;

            if (f.getAction().equals(""))
                continue;

            if (actionAnn == null) {
                actionAnn = jMethod.annotate(Action.class);
            }
            if (jam == null) {
                jam = actionAnn.paramArray("fault");
            }
            final JAnnotationUse faAnn = jam.annotate(FaultAction.class);
            faAnn.param("className", map.get(f.getName()));
            faAnn.param("value", f.getAction());
        }
    }
}
项目:openjdk9    文件:CustomExceptionGenerator.java   
private void write(Fault fault) throws JClassAlreadyExistsException {
    String className = Names.customExceptionClassName(fault);

    JDefinedClass cls = cm._class(className, ClassType.CLASS);
    JDocComment comment = cls.javadoc();
    if(fault.getJavaDoc() != null){
        comment.add(fault.getJavaDoc());
        comment.add("\n\n");
    }

    for (String doc : getJAXWSClassComment()) {
        comment.add(doc);
    }

    cls._extends(java.lang.Exception.class);

    //@WebFault
    JAnnotationUse faultAnn = cls.annotate(WebFault.class);
    faultAnn.param("name", fault.getBlock().getName().getLocalPart());
    faultAnn.param("targetNamespace", fault.getBlock().getName().getNamespaceURI());

    JType faultBean = fault.getBlock().getType().getJavaType().getType().getType();

    //faultInfo filed
    JFieldVar fi = cls.field(JMod.PRIVATE, faultBean, "faultInfo");

    //add jaxb annotations
    fault.getBlock().getType().getJavaType().getType().annotate(fi);

    fi.javadoc().add("Java type that goes as soapenv:Fault detail element.");
    JFieldRef fr = JExpr.ref(JExpr._this(), fi);

    //Constructor
    JMethod constrc1 = cls.constructor(JMod.PUBLIC);
    JVar var1 = constrc1.param(String.class, "message");
    JVar var2 = constrc1.param(faultBean, "faultInfo");
    constrc1.javadoc().addParam(var1);
    constrc1.javadoc().addParam(var2);
    JBlock cb1 = constrc1.body();
    cb1.invoke("super").arg(var1);

    cb1.assign(fr, var2);

    //constructor with Throwable
    JMethod constrc2 = cls.constructor(JMod.PUBLIC);
    var1 = constrc2.param(String.class, "message");
    var2 = constrc2.param(faultBean, "faultInfo");
    JVar var3 = constrc2.param(Throwable.class, "cause");
    constrc2.javadoc().addParam(var1);
    constrc2.javadoc().addParam(var2);
    constrc2.javadoc().addParam(var3);
    JBlock cb2 = constrc2.body();
    cb2.invoke("super").arg(var1).arg(var3);
    cb2.assign(fr, var2);


    //getFaultInfo() method
    JMethod fim = cls.method(JMod.PUBLIC, faultBean, "getFaultInfo");
    fim.javadoc().addReturn().add("returns fault bean: "+faultBean.fullName());
    JBlock fib = fim.body();
    fib._return(fi);
    fault.setExceptionClass(cls);

}
项目:openjdk9    文件:ServiceGenerator.java   
private void writeWebEndpoint(Port port, JMethod m) {
    JAnnotationUse webEndpointAnn = m.annotate(cm.ref(WebEndpoint.class));
    webEndpointAnn.param("name", port.getName().getLocalPart());
}
项目:openjdk9    文件:W3CAddressingJavaGeneratorExtension.java   
@Override
public void writeMethodAnnotations(TWSDLOperation two, JMethod jMethod) {
    JAnnotationUse actionAnn = null;

    if (!(two instanceof Operation))
        return;

    Operation o = ((Operation)two);

    // explicit input action
    if (o.getInput().getAction() != null && !o.getInput().getAction().equals("")) {
        // explicitly specified
        actionAnn = jMethod.annotate(Action.class);
        actionAnn.param("input", o.getInput().getAction());
    }

    // explicit output action
    if (o.getOutput() != null && o.getOutput().getAction() != null && !o.getOutput().getAction().equals("")) {
        // explicitly specified
        if (actionAnn == null)
            actionAnn = jMethod.annotate(Action.class);

        actionAnn.param("output", o.getOutput().getAction());
    }

    // explicit fault action
    if (o.getFaults() != null && o.getFaults().size() > 0) {
        Map<String, JClass> map = o.getFaults();
        JAnnotationArrayMember jam = null;

        for (Fault f : o.faults()) {
            if (f.getAction() == null)
                continue;

            if (f.getAction().equals(""))
                continue;

            if (actionAnn == null) {
                actionAnn = jMethod.annotate(Action.class);
            }
            if (jam == null) {
                jam = actionAnn.paramArray("fault");
            }
            final JAnnotationUse faAnn = jam.annotate(FaultAction.class);
            faAnn.param("className", map.get(f.getName()));
            faAnn.param("value", f.getAction());
        }
    }
}
项目:lookaside_java-1.8.0-openjdk    文件:CustomExceptionGenerator.java   
private void write(Fault fault) throws JClassAlreadyExistsException {
    String className = Names.customExceptionClassName(fault);

    JDefinedClass cls = cm._class(className, ClassType.CLASS);
    JDocComment comment = cls.javadoc();
    if(fault.getJavaDoc() != null){
        comment.add(fault.getJavaDoc());
        comment.add("\n\n");
    }

    for (String doc : getJAXWSClassComment()) {
        comment.add(doc);
    }

    cls._extends(java.lang.Exception.class);

    //@WebFault
    JAnnotationUse faultAnn = cls.annotate(WebFault.class);
    faultAnn.param("name", fault.getBlock().getName().getLocalPart());
    faultAnn.param("targetNamespace", fault.getBlock().getName().getNamespaceURI());

    JType faultBean = fault.getBlock().getType().getJavaType().getType().getType();

    //faultInfo filed
    JFieldVar fi = cls.field(JMod.PRIVATE, faultBean, "faultInfo");

    //add jaxb annotations
    fault.getBlock().getType().getJavaType().getType().annotate(fi);

    fi.javadoc().add("Java type that goes as soapenv:Fault detail element.");
    JFieldRef fr = JExpr.ref(JExpr._this(), fi);

    //Constructor
    JMethod constrc1 = cls.constructor(JMod.PUBLIC);
    JVar var1 = constrc1.param(String.class, "message");
    JVar var2 = constrc1.param(faultBean, "faultInfo");
    constrc1.javadoc().addParam(var1);
    constrc1.javadoc().addParam(var2);
    JBlock cb1 = constrc1.body();
    cb1.invoke("super").arg(var1);

    cb1.assign(fr, var2);

    //constructor with Throwable
    JMethod constrc2 = cls.constructor(JMod.PUBLIC);
    var1 = constrc2.param(String.class, "message");
    var2 = constrc2.param(faultBean, "faultInfo");
    JVar var3 = constrc2.param(Throwable.class, "cause");
    constrc2.javadoc().addParam(var1);
    constrc2.javadoc().addParam(var2);
    constrc2.javadoc().addParam(var3);
    JBlock cb2 = constrc2.body();
    cb2.invoke("super").arg(var1).arg(var3);
    cb2.assign(fr, var2);


    //getFaultInfo() method
    JMethod fim = cls.method(JMod.PUBLIC, faultBean, "getFaultInfo");
    fim.javadoc().addReturn().add("returns fault bean: "+faultBean.fullName());
    JBlock fib = fim.body();
    fib._return(fi);
    fault.setExceptionClass(cls);

}
项目:lookaside_java-1.8.0-openjdk    文件:ServiceGenerator.java   
private void writeWebEndpoint(Port port, JMethod m) {
    JAnnotationUse webEndpointAnn = m.annotate(cm.ref(WebEndpoint.class));
    webEndpointAnn.param("name", port.getName().getLocalPart());
}
项目:lookaside_java-1.8.0-openjdk    文件:W3CAddressingJavaGeneratorExtension.java   
@Override
public void writeMethodAnnotations(TWSDLOperation two, JMethod jMethod) {
    JAnnotationUse actionAnn = null;

    if (!(two instanceof Operation))
        return;

    Operation o = ((Operation)two);

    // explicit input action
    if (o.getInput().getAction() != null && !o.getInput().getAction().equals("")) {
        // explicitly specified
        actionAnn = jMethod.annotate(Action.class);
        actionAnn.param("input", o.getInput().getAction());
    }

    // explicit output action
    if (o.getOutput() != null && o.getOutput().getAction() != null && !o.getOutput().getAction().equals("")) {
        // explicitly specified
        if (actionAnn == null)
            actionAnn = jMethod.annotate(Action.class);

        actionAnn.param("output", o.getOutput().getAction());
    }

    // explicit fault action
    if (o.getFaults() != null && o.getFaults().size() > 0) {
        Map<String, JClass> map = o.getFaults();
        JAnnotationArrayMember jam = null;

        for (Fault f : o.faults()) {
            if (f.getAction() == null)
                continue;

            if (f.getAction().equals(""))
                continue;

            if (actionAnn == null) {
                actionAnn = jMethod.annotate(Action.class);
            }
            if (jam == null) {
                jam = actionAnn.paramArray("fault");
            }
            final JAnnotationUse faAnn = jam.annotate(FaultAction.class);
            faAnn.param("className", map.get(f.getName()));
            faAnn.param("value", f.getAction());
        }
    }
}
项目:infobip-open-jdk-8    文件:CustomExceptionGenerator.java   
private void write(Fault fault) throws JClassAlreadyExistsException {
    String className = Names.customExceptionClassName(fault);

    JDefinedClass cls = cm._class(className, ClassType.CLASS);
    JDocComment comment = cls.javadoc();
    if(fault.getJavaDoc() != null){
        comment.add(fault.getJavaDoc());
        comment.add("\n\n");
    }

    for (String doc : getJAXWSClassComment()) {
        comment.add(doc);
    }

    cls._extends(java.lang.Exception.class);

    //@WebFault
    JAnnotationUse faultAnn = cls.annotate(WebFault.class);
    faultAnn.param("name", fault.getBlock().getName().getLocalPart());
    faultAnn.param("targetNamespace", fault.getBlock().getName().getNamespaceURI());

    JType faultBean = fault.getBlock().getType().getJavaType().getType().getType();

    //faultInfo filed
    JFieldVar fi = cls.field(JMod.PRIVATE, faultBean, "faultInfo");

    //add jaxb annotations
    fault.getBlock().getType().getJavaType().getType().annotate(fi);

    fi.javadoc().add("Java type that goes as soapenv:Fault detail element.");
    JFieldRef fr = JExpr.ref(JExpr._this(), fi);

    //Constructor
    JMethod constrc1 = cls.constructor(JMod.PUBLIC);
    JVar var1 = constrc1.param(String.class, "message");
    JVar var2 = constrc1.param(faultBean, "faultInfo");
    constrc1.javadoc().addParam(var1);
    constrc1.javadoc().addParam(var2);
    JBlock cb1 = constrc1.body();
    cb1.invoke("super").arg(var1);

    cb1.assign(fr, var2);

    //constructor with Throwable
    JMethod constrc2 = cls.constructor(JMod.PUBLIC);
    var1 = constrc2.param(String.class, "message");
    var2 = constrc2.param(faultBean, "faultInfo");
    JVar var3 = constrc2.param(Throwable.class, "cause");
    constrc2.javadoc().addParam(var1);
    constrc2.javadoc().addParam(var2);
    constrc2.javadoc().addParam(var3);
    JBlock cb2 = constrc2.body();
    cb2.invoke("super").arg(var1).arg(var3);
    cb2.assign(fr, var2);


    //getFaultInfo() method
    JMethod fim = cls.method(JMod.PUBLIC, faultBean, "getFaultInfo");
    fim.javadoc().addReturn().add("returns fault bean: "+faultBean.fullName());
    JBlock fib = fim.body();
    fib._return(fi);
    fault.setExceptionClass(cls);

}
项目:infobip-open-jdk-8    文件:ServiceGenerator.java   
private void writeWebEndpoint(Port port, JMethod m) {
    JAnnotationUse webEndpointAnn = m.annotate(cm.ref(WebEndpoint.class));
    webEndpointAnn.param("name", port.getName().getLocalPart());
}