Package cn.shenyanchao.builder

Examples of cn.shenyanchao.builder.ClassTypeBuilder


        List typeList = compilationUnit.getTypes();
        for (Object type : typeList) {
            TypeDeclaration typeDeclaration = (TypeDeclaration) type;
            String className = typeDeclaration.getName();
            getLog().info("className:" + className);
            ClassTypeBuilder classTypeBuilder = new ClassTypeBuilder(className + Consts.TEST_SUFFIX);
            //process methods
            List<MethodDeclaration> methodDeclarations = MembersFilter.findMethodsFrom(typeDeclaration);
            for (MethodDeclaration methodDeclaration : methodDeclarations) {
                //has method and add import
                compilationUnitBuilder.buildImports(null);

                String methodName = methodDeclaration.getName();
                getLog().info("methodName:" + methodDeclaration.getName());
                classTypeBuilder.buildMethod(methodName + Consts.TEST_SUFFIX, methodDeclaration);
            }

            compilationUnitBuilder.buildClass(classTypeBuilder.build());
        }

        CompilationUnit testCompilationUnit = compilationUnitBuilder.build();

        //写入测试代码文件
View Full Code Here

TOP

Related Classes of cn.shenyanchao.builder.ClassTypeBuilder

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.