Package com.sun.codemodel

Examples of com.sun.codemodel.JMethod


       
        JCodeModel model = generator.getCodeModel();
        JDefinedClass echo = model._getClass("jsr181.echo.wrapped.EchoPortType");
        assertNotNull(echo);
       
        JMethod method = echo.getMethod("echo", new JType[] { model.ref(String.class) });
        assertNotNull(method);
        assertEquals( model.ref(String.class), method.type() );
       
        assertNotNull(model._getClass("jsr181.echo.wrapped.EchoClient"));
        assertNotNull(model._getClass("jsr181.echo.wrapped.EchoImpl"));
    }
View Full Code Here


       
        JCodeModel model = generator.getCodeModel();
        JDefinedClass echo = model._getClass("echo.wrapped.unbounded.EchoPortType");
        assertNotNull(echo);
       
        JMethod jm = echo.methods().iterator().next();
        assertEquals("java.util.List<java.lang.String>", jm.type().fullName());
    }
View Full Code Here

       
        JCodeModel model = generator.getCodeModel();
        JDefinedClass echo = model._getClass("echo.wrapped.keyword.EchoPortType");
        assertNotNull(echo);
       
        JMethod jm = echo.methods().iterator().next();
        assertEquals("java.util.List<java.lang.String>", jm.type().fullName());
    }
View Full Code Here

       
        JCodeModel model = generator.getCodeModel();
        JDefinedClass echo = model._getClass("echo.wrapped.mtom.EchoPortType");
        assertNotNull(echo);
       
        JMethod jm = echo.methods().iterator().next();
        assertEquals("javax.activation.DataHandler", jm.type().fullName());
    }
View Full Code Here

        JCodeModel model = generator.getCodeModel();
        JDefinedClass concat = model._getClass("org.codehaus.xfire.generator.messagepart.concatPortType");
        assertNotNull(concat);
       
        JType string = model._ref(String.class);
        JMethod method = concat.getMethod("concat", new JType[] { string, string });
       
        // if there were a way to look at the annotations we would do that here.
    }
View Full Code Here

        return routerClass;
    }

    private void addRouterMethod(JDefinedClass router, JDefinedClass definedClass) {
        String className = definedClass.fullName();
        JMethod method = router.method(generateMods, definedClass, definedClass.name());
        JBlock block = method.body();
        block.directStatement("return new " + className + "();");
    }
View Full Code Here

    @Override
    protected void run(Set<ClassOutline> classes) {
        final JDefinedClass _interface = outline.getClassFactory().createInterface(jpackage, "Visitable", null);
    setOutput( _interface );
    final JMethod _method = getOutput().method(JMod.PUBLIC, void.class, "accept");
    final JTypeVar returnType = _method.generify("R");
    final JTypeVar exceptionType = _method.generify("E", Throwable.class);
    _method.type(returnType);
    _method._throws(exceptionType);
    final JClass narrowedVisitor = visitor.narrow(returnType, exceptionType);
    _method.param(narrowedVisitor, "aVisitor");
       
        for(ClassOutline classOutline : classes) {
            classOutline.implClass._implements(getOutput());
        }
    }
View Full Code Here

        setOutput( _interface );
       
        for(ClassOutline classOutline : classes) {
            if (!classOutline.target.isAbstract()) {
                // add the bean to the visitor
                JMethod vizMethod = getOutput().method(JMod.PUBLIC, returnType, "visit");
                vizMethod._throws(exceptionType);
                vizMethod.param(classOutline.implClass, "aBean");
            }
        }
    }
View Full Code Here

        final JTypeVar exceptionType = _interface.generify("E", Throwable.class);
        final JClass narrowedVisitor = visitor.narrow(retType).narrow(exceptionType);
        for (ClassOutline classOutline : classes) {
            if (!classOutline.target.isAbstract()) {
                // add the bean to the traverser
                JMethod traverseMethod = getOutput().method(JMod.PUBLIC, void.class, "traverse");
                traverseMethod._throws(exceptionType);
                traverseMethod.param(classOutline.implClass, "aBean");
                traverseMethod.param(narrowedVisitor, "aVisitor");
            }
        }
        jpackage.remove(scratch);
    }
View Full Code Here

    final JClass narrowedVisitor = visitor.narrow(returnType, exceptionType);
        getOutput()._implements(narrowedVisitor);
        for (ClassOutline classOutline : classes) {
            if (!classOutline.target.isAbstract()) {
                // add the method to the base vizzy
                JMethod _method = getOutput().method(JMod.PUBLIC, returnType, "visit");
                _method._throws(exceptionType);
        _method.param(classOutline.implClass, "aBean");
        _method.body()._return(JExpr._null());
            }
        }
    }
View Full Code Here

TOP

Related Classes of com.sun.codemodel.JMethod

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.