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

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


            if (descriptor == null) {
                continue;
            }

            TypeDeclaration objectClass = createObjectClass(context, descriptor);
            if (objectClass == null) {
                continue;
            }

            Type objectType = importer.resolvePackageMember(
                    Models.append(factory, getClassName(), objectClass.getName()));
            if (context.element.getTypeParameters().isEmpty() == false) {
                objectType = new TypeBuilder(factory, objectType)
                        .parameterize(util.toTypeVariables(context.element))
                        .toType();
            }
View Full Code Here


            this.keyType = importer.resolve(factory.newNamedType(keyTypeName));
            this.valueType = importer.resolve(factory.newNamedType(valueTypeName));
        }

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

            this.names = new NameGenerator(factory);
            this.connection = new FragmentConnection(environment, fragment, names, importer);
        }

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

                    factory.newPackageDeclaration(fqn.getQualifier()),
                    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

     */
    public PrintWriter openFor(CompilationUnit unit) throws IOException {
        if (unit == null) {
            throw new IllegalArgumentException("unit must not be null"); //$NON-NLS-1$
        }
        TypeDeclaration primary = findPrimaryType(unit);
        if (primary == null) {
            return openFor(unit.getPackageDeclaration(), PACKAGE_INFO);
        }
        return openFor(unit.getPackageDeclaration(), primary);
    }
View Full Code Here

     */
    public static TypeDeclaration findPrimaryType(CompilationUnit unit) {
        if (unit == null) {
            throw new IllegalArgumentException("unit must not be null"); //$NON-NLS-1$
        }
        TypeDeclaration first = null;
        for (TypeDeclaration decl : unit.getTypeDeclarations()) {
            if (first == null) {
                first = decl;
            }
            for (Attribute attribute : decl.getModifiers()) {
View Full Code Here

            this.partitioner = partitioner;
            this.reducer = reducer;
        }

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

        StringBuilder name = new StringBuilder();
        if (unit.getPackageDeclaration() != null) {
            name.append(unit.getPackageDeclaration().getName());
            name.append('.');
        }
        TypeDeclaration primary = Emitter.findPrimaryType(unit);
        if (primary == null) {
            name.append("package-info");
        } else {
            name.append(primary.getName());
        }
        JavaFileObject source = filer.createSourceFile(name, originatingElements);
        Writer writer = source.openWriter();
        try {
            PrintWriter output = new PrintWriter(writer);
View Full Code Here

                dataClass = new DataClass.Unresolved(factory, getInputTypeAsReflect());
            }
        }

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

                    model.getReduceUnits());
            this.context = names.create("context");
        }

        public CompilationUnit generate() {
            TypeDeclaration type = createType();
            return factory.newCompilationUnit(
                    importer.getPackageDeclaration(),
                    importer.toImportDeclarations(),
                    Collections.singletonList(type),
                    Collections.<Comment>emptyList());
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.