Package com.sun.tools.ws.processor.model.java

Examples of com.sun.tools.ws.processor.model.java.JavaMethod


       
        // @SOAPBinding
        seiInfo.setSoapBindingAnnotation(getSOAPBindingAnnotation(port));
       
            for (Operation operation: port.getOperations()) {
                JavaMethod method = operation.getJavaMethod();
               
          MethodInfo methodInfo = new MethodInfo();
          // method name
          methodInfo.setName(method.getName());
         
          // method doc comment
          String methodJavaDoc = operation.getJavaDoc();
          if (methodJavaDoc == null) {
            methodJavaDoc = "public method";
          }
         
          // method return type
                String returnTypeName;
          if(method.getReturnType().getName().equals("void")){
            returnTypeName = "void";
                } else {
                  returnTypeName = method.getReturnType().getType()
            .getName();
                }
          if (this.isWrapped(operation)) { // wrapped response
                Response response = operation.getResponse();
                    Block resBlock = response.getBodyBlocks().next();
                    returnTypeName = resBlock.getType().getJavaType().getName();
          }
          TypeInfo returnType = new TypeInfo();
          returnType.setFullName(returnTypeName);
          returnType.setName(ClassNameUtil
              .stripQualifier(returnTypeName));
          methodInfo.setReturnType(returnType);
         
          methodInfo.setWebMethodAnnotation(getWebMethodAnnotation(operation, method.getName()));
          methodInfo.setWebResultAnnotation(getWebResultAnnotation(operation));
          methodInfo.setSoapBindingAnnotation(getSOAPBindingAnnotation(operation));
         
          if (this.isWrapped(operation)) { // wrapped request parameter
                  Block reqBlock = operation.getRequest().getBodyBlocks().next();
                  String parameterTypeName = reqBlock.getType().getJavaType().getName();
                 
            ParameterInfo paramInfo = new ParameterInfo();
                  paramInfo.setName("request");
            // param type
            TypeInfo paramType = new TypeInfo();
            paramType.setFullName(parameterTypeName);
            paramType.setName(ClassNameUtil
                .stripQualifier(parameterTypeName));
            paramInfo.setType(paramType);
           
            // add this param in method definition
            methodInfo.getParameters().add(paramInfo);
          } else {
            for (JavaParameter parameter : method.getParametersList()) {
              ParameterInfo paramInfo = new ParameterInfo();
             
              // param name
              paramInfo.setName(parameter.getName());
              // param type
View Full Code Here


        //@XmlSeeAlso
        if(options.target.isLaterThan(Options.Target.V2_1))
            writeXmlSeeAlso(cls);

        for (Operation operation: port.getOperations()) {
            JavaMethod method = operation.getJavaMethod();

            //@WebMethod
            JMethod m;
            JDocComment methodDoc;
            String methodJavaDoc = operation.getJavaDoc();
            if(method.getReturnType().getName().equals("void")){
                m = cls.method(JMod.PUBLIC, void.class, method.getName());
                methodDoc = m.javadoc();
            }else {
                JAXBTypeAndAnnotation retType = method.getReturnType().getType();
                m = cls.method(JMod.PUBLIC, retType.getType(), method.getName());
                retType.annotate(m);
                methodDoc = m.javadoc();
                JCommentPart ret = methodDoc.addReturn();
                ret.add("returns "+retType.getName());
            }
            if(methodJavaDoc != null)
                methodDoc.add(methodJavaDoc);

            writeWebMethod(operation, m);
            JClass holder = cm.ref(Holder.class);
            for (JavaParameter parameter: method.getParametersList()) {
                JVar var;
                JAXBTypeAndAnnotation paramType = parameter.getType().getType();
                if (parameter.isHolder()) {
                    var = m.param(holder.narrow(paramType.getType().boxify()), parameter.getName());
                }else{
View Full Code Here

        //@XmlSeeAlso
        if(options.target.isLaterThan(Options.Target.V2_1))
            writeXmlSeeAlso(cls);

        for (Operation operation: port.getOperations()) {
            JavaMethod method = operation.getJavaMethod();

            //@WebMethod
            JMethod m;
            JDocComment methodDoc;
            String methodJavaDoc = operation.getJavaDoc();
            if(method.getReturnType().getName().equals("void")){
                m = cls.method(JMod.PUBLIC, void.class, method.getName());
                methodDoc = m.javadoc();
            }else {
                JAXBTypeAndAnnotation retType = method.getReturnType().getType();
                m = cls.method(JMod.PUBLIC, retType.getType(), method.getName());
                retType.annotate(m);
                methodDoc = m.javadoc();
                JCommentPart ret = methodDoc.addReturn();
                ret.add("returns "+retType.getName());
            }
            if(methodJavaDoc != null)
                methodDoc.add(methodJavaDoc);

            writeWebMethod(operation, m);
            JClass holder = cm.ref(Holder.class);
            for (JavaParameter parameter: method.getParametersList()) {
                JVar var;
                JAXBTypeAndAnnotation paramType = parameter.getType().getType();
                if (parameter.isHolder()) {
                    var = m.param(holder.narrow(paramType.getType().boxify()), parameter.getName());
                }else{
View Full Code Here

        if (options.target.isLaterThan(Options.Target.V2_1)) {
            writeXmlSeeAlso(cls);
        }

        for (Operation operation: port.getOperations()) {
            JavaMethod method = operation.getJavaMethod();

            //@WebMethod
            JMethod m;
            JDocComment methodDoc;
            String methodJavaDoc = operation.getJavaDoc();
            if(method.getReturnType().getName().equals("void")){
                m = cls.method(JMod.PUBLIC, void.class, method.getName());
                methodDoc = m.javadoc();
            }else {
                JAXBTypeAndAnnotation retType = method.getReturnType().getType();
                m = cls.method(JMod.PUBLIC, retType.getType(), method.getName());
                retType.annotate(m);
                methodDoc = m.javadoc();
                JCommentPart ret = methodDoc.addReturn();
                ret.add("returns "+retType.getName());
            }
            if (methodJavaDoc != null) {
                methodDoc.add(methodJavaDoc);
            }

            writeWebMethod(operation, m);
            JClass holder = cm.ref(Holder.class);
            for (JavaParameter parameter: method.getParametersList()) {
                JVar var;
                JAXBTypeAndAnnotation paramType = parameter.getType().getType();
                if (parameter.isHolder()) {
                    var = m.param(holder.narrow(paramType.getType().boxify()), parameter.getName());
                }else{
View Full Code Here

                f.writeWebServiceAnnotation(model, cm, cls, port);
            }

      // WebMethods
      for (Operation operation : port.getOperations()) {
        JavaMethod method = operation.getJavaMethod();

        // @WebMethod
        JMethod m;
        JDocComment methodDoc;
        String methodJavaDoc = operation.getJavaDoc();
        if (method.getReturnType().getName().equals("void")) {
          m = cls.method(JMod.PUBLIC, void.class, method.getName());
          methodDoc = m.javadoc();
        } else {
          JAXBTypeAndAnnotation retType = method.getReturnType().getType();
          m = cls.method(JMod.PUBLIC, retType.getType(), method.getName());
          retType.annotate(m);
          methodDoc = m.javadoc();
          JCommentPart ret = methodDoc.addReturn();
          ret.add("returns " + retType.getName());
        }

        if (methodJavaDoc != null)
          methodDoc.add(methodJavaDoc);

        JClass holder = cm.ref(Holder.class);
        for (JavaParameter parameter : method.getParametersList()) {
          JVar var;
          JAXBTypeAndAnnotation paramType = parameter.getType().getType();
          if (parameter.isHolder()) {
            var = m.param(holder.narrow(paramType.getType().boxify()),
                parameter.getName());
          } else {
            var = m.param(paramType.getType(), parameter.getName());
          }
          methodDoc.addParam(var);
        }

        com.sun.tools.ws.wsdl.document.Operation wsdlOp = operation
            .getWSDLPortTypeOperation();
        for (Fault fault : operation.getFaultsSet()) {
          m._throws(fault.getExceptionClass());
          methodDoc.addThrows(fault.getExceptionClass());
          wsdlOp.putFault(fault.getWsdlFaultName(), fault.getExceptionClass());
        }
        m.body().block().directStatement("//replace with your impl here");
        m.body().block().directStatement(
            getReturnString(method.getReturnType().getName()));
      }
    }
  }
View Full Code Here

TOP

Related Classes of com.sun.tools.ws.processor.model.java.JavaMethod

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.