Package com.thoughtworks.qdox.parser.structs

Examples of com.thoughtworks.qdox.parser.structs.MethodDef


        ClassDef innerDef = new ClassDef();
        innerDef.name = "Inner";
        builder.beginClass(innerDef);

        MethodDef fooDef = new MethodDef();
        fooDef.name = "foo";
        builder.addMethod(fooDef);
        builder.endClass();

        MethodDef barDef = new MethodDef();
        barDef.name = "bar";
        builder.addMethod(barDef);
        builder.endClass();

        JavaSource source = builder.getSource();
View Full Code Here


        assertEquals("foo", innerClass.getMethods()[0].getName());
    }

    public void testSimpleMethod() throws Exception {
        builder.beginClass(new ClassDef());
        MethodDef mth = new MethodDef();
        mth.name = "doSomething";
        mth.returns = "void";
        builder.addMethod(mth);
        builder.endClass();
View Full Code Here

        assertEquals(0, doSomething.getExceptions().length);
    }

    public void testMethodNoArray() throws Exception {
        builder.beginClass(new ClassDef());
        MethodDef mth = new MethodDef();
        mth.name = "doSomething";
        mth.returns = "void";
        mth.dimensions = 0;
        builder.addMethod(mth);
        builder.endClass();
View Full Code Here

        assertEquals(0, result.getReturns().getDimensions());
    }

    public void testMethod1dArray() throws Exception {
        builder.beginClass(new ClassDef());
        MethodDef mth = new MethodDef();
        mth.name = "doSomething";
        mth.returns = "void";
        mth.dimensions = 1;
        builder.addMethod(mth);
        builder.endClass();
View Full Code Here

        assertEquals(1, result.getReturns().getDimensions());
    }

    public void testMethod2dArray() throws Exception {
        builder.beginClass(new ClassDef());
        MethodDef mth = new MethodDef();
        mth.name = "doSomething";
        mth.returns = "void";
        mth.dimensions = 2;
        builder.addMethod(mth);
        builder.endClass();
View Full Code Here

        assertEquals(2, result.getReturns().getDimensions());
    }

    public void testMethodParameters() throws Exception {
        builder.beginClass(new ClassDef());
        MethodDef mth = new MethodDef();

        FieldDef f1 = new FieldDef();
        f1.name = "count";
        f1.type = "int";
        f1.modifiers.add("final");
View Full Code Here

        assertEquals("String", result.getParameters()[1].getType().getValue());
    }

    public void testMethodParametersWithArrays() throws Exception {
        builder.beginClass(new ClassDef());
        MethodDef mth = new MethodDef();

        FieldDef f1 = new FieldDef();
        f1.name = "count";
        f1.type = "int";
        f1.modifiers.add("final");
View Full Code Here

        assertEquals(2, result.getParameters()[1].getType().getDimensions());
    }

    public void testMethodExceptions() throws Exception {
        builder.beginClass(new ClassDef());
        MethodDef mth = new MethodDef();

        mth.exceptions.add("RuntimeException");
        mth.exceptions.add("java.io.IOException");

        builder.addMethod(mth);
View Full Code Here

        assertEquals("java.io.IOException", result.getExceptions()[1].getValue());
    }

    public void testMethodModifiers() throws Exception {
        builder.beginClass(new ClassDef());
        MethodDef mth = new MethodDef();

        mth.modifiers.add("public");
        mth.modifiers.add("final");
        mth.modifiers.add("synchronized");
View Full Code Here

    }

    public void testSimpleConstructor() throws Exception {
        builder.beginClass(new ClassDef());

        MethodDef mth = new MethodDef();
        mth.name = "MyClass";
        mth.constructor = true;
        builder.addMethod(mth);

        MethodDef mth2 = new MethodDef();
        mth2.name = "method";
        mth2.returns = "void";
        builder.addMethod(mth2);
        builder.endClass();
View Full Code Here

TOP

Related Classes of com.thoughtworks.qdox.parser.structs.MethodDef

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.