Package com.asakusafw.utils.java.model.syntax

Examples of com.asakusafw.utils.java.model.syntax.TypeDeclaration


                    factory.newPackageDeclaration(packageName),
                    ImportBuilder.Strategy.TOP_LEVEL);
        }

        public CompilationUnit generate() {
            TypeDeclaration type = createType();
            return factory.newCompilationUnit(
                    importer.getPackageDeclaration(),
                    importer.toImportDeclarations(),
                    Collections.singletonList(type),
                    Collections.<Comment>emptyList());
View Full Code Here


        // インポートビルダーの初期化
        imports = new ImportBuilder(f, packageDecl, ImportBuilder.Strategy.TOP_LEVEL);

        // 型宣言の計算
        TypeDeclaration type = createTypeDeclaration(model);

        // コンパイル単位化
        CompilationUnit unit = f.newCompilationUnit(
                packageDecl,
                imports.toImportDeclarations(),
View Full Code Here

                    factory.newPackageDeclaration(packageName),
                    ImportBuilder.Strategy.TOP_LEVEL);
        }

        public CompilationUnit generate() {
            TypeDeclaration type = createType();
            return factory.newCompilationUnit(
                    importer.getPackageDeclaration(),
                    importer.toImportDeclarations(),
                    Collections.singletonList(type),
                    Collections.<Comment>emptyList());
View Full Code Here

     * @param source 対象ソースプログラム
     * @return 出力
     */
    protected PrintWriter createOutputFor(CompilationUnit source) {
        StringBuilder buf = new StringBuilder();
        TypeDeclaration type = Emitter.findPrimaryType(source);
        if (source.getPackageDeclaration() != null) {
            buf.append(source.getPackageDeclaration().toString().replace('.', '/'));
            buf.append('/');
        }
        buf.append(type.getName().getToken());
        VolatileJavaFile file = new VolatileJavaFile(buf.toString());
        files.add(file);
        return new PrintWriter(file.openWriter());
    }
View Full Code Here

        if (packageDeclaration != null) {
            String pkg = packageDeclaration.getName().toNameString().replace('.', '/');
            buf.append(pkg);
            buf.append('/');
        }
        TypeDeclaration primaryType = findPrimaryType(unit);
        if (primaryType != null) {
            buf.append(primaryType.getName().toNameString());
        } else {
            buf.append("package-info");
        }
        buf.append(".java");
        return buf.toString();
View Full Code Here

        return buf.toString();
    }

    private static TypeDeclaration findPrimaryType(CompilationUnit unit) {
        assert unit != null;
        TypeDeclaration first = null;
        for (TypeDeclaration decl : unit.getTypeDeclarations()) {
            if (first == null) {
                first = decl;
            }
            for (Attribute attribute : decl.getModifiers()) {
View Full Code Here

TOP

Related Classes of com.asakusafw.utils.java.model.syntax.TypeDeclaration

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.