Examples of ImportBuilder


Examples of com.asakusafw.utils.java.model.util.ImportBuilder

            assert valueTypeName != null;
            this.environment = environment;
            this.segment = segment;
            this.factory = environment.getModelFactory();
            Name packageName = environment.getStagePackageName(stageBlock.getStageNumber());
            this.importer = new ImportBuilder(
                    factory,
                    factory.newPackageDeclaration(packageName),
                    ImportBuilder.Strategy.TOP_LEVEL);
            this.names = new NameGenerator(factory);
            this.collector = names.create("collector");
View Full Code Here

Examples of com.asakusafw.utils.java.model.util.ImportBuilder

         * @throws IllegalArgumentException 引数に{@code null}が指定された場合
         */
        public void addAttribute(Enum<? extends FlowElementAttribute> constant) {
            Precondition.checkMustNotBeNull(constant, "constant"); //$NON-NLS-1$
            ModelFactory f = context.environment.getFactory();
            ImportBuilder ib = context.importer;
            Expression attribute = new TypeBuilder(f, ib.toType(constant.getDeclaringClass()))
                .field(constant.name())
                .toExpression();
            addAttribute(attribute);
        }
View Full Code Here

Examples of com.asakusafw.utils.java.model.util.ImportBuilder

         * @throws IllegalArgumentException 引数に{@code null}が指定された場合
         */
        public void addOperatorHelper(ExecutableElement helperMethod) {
            Precondition.checkMustNotBeNull(helperMethod, "helperMethod"); //$NON-NLS-1$
            ModelFactory f = context.environment.getFactory();
            ImportBuilder ib = context.importer;
            Jsr269 conv = new Jsr269(f);
            List<Expression> parameterTypeLiterals = Lists.create();
            for (VariableElement parameter : helperMethod.getParameters()) {
                TypeMirror type = context.environment.getErasure(parameter.asType());
                parameterTypeLiterals.add(new TypeBuilder(f, ib.resolve(conv.convert(type)))
                    .dotClass()
                    .toExpression());
            }
            Expression attribute = new TypeBuilder(f, ib.toType(OperatorHelper.class))
                .newObject(new Expression[] {
                        // name
                        Models.toLiteral(f, helperMethod.getSimpleName().toString()),
                        // parameter types
                        new TypeBuilder(f, ib.toType(Arrays.class))
                            .method("asList", new TypeBuilder(f, ib.toType(Class.class))
                                .parameterize(f.newWildcard())
                                .array(1)
                                .newArray(f.newArrayInitializer(parameterTypeLiterals))
                                .toExpression())
                            .toExpression()
View Full Code Here

Examples of com.asakusafw.utils.java.model.util.ImportBuilder

        assert environment != null;
        assert resource != null;
        this.environment = environment;
        this.factory = environment.getModelFactory();
        Name packageName = environment.getResourcePackage("join");
        this.importer = new ImportBuilder(
                factory,
                factory.newPackageDeclaration(packageName),
                ImportBuilder.Strategy.TOP_LEVEL);
        this.resource = resource;
    }
View Full Code Here

Examples of com.asakusafw.utils.java.model.util.ImportBuilder

            ModelFactory factory = Models.getModelFactory();
            PackageElement pkg = (PackageElement) operatorClass.getElement().getEnclosingElement();
            OperatorClassGenerator generator = new OperatorFactoryClassGenerator(
                    env,
                    factory,
                    new ImportBuilder(
                            factory,
                            new Jsr269(factory).convert(pkg),
                            Strategy.TOP_LEVEL),
                            operatorClass);
            return generator.generate();
View Full Code Here

Examples of com.asakusafw.utils.java.model.util.ImportBuilder

        if (key != null && environment.isResourceGenerated(key)) {
            return;
        }
        ModelFactory f = environment.getFactory();
        PackageDeclaration packageDecl = getPackage(f, operatorClass);
        ImportBuilder imports = getImportBuilder(f, packageDecl);
        OperatorClassGenerator generator = new OperatorImplementationClassGenerator(
                environment,
                f,
                imports,
                operatorClass);
        TypeDeclaration type = generator.generate();
        if (type == null) {
            sawError = true;
            return;
        }
        List<ImportDeclaration> decls = imports.toImportDeclarations();

        try {
            emit(key, f, packageDecl, decls, type, operatorClass.getElement());
        } catch (IOException e) {
            LOG.debug(e.getMessage(), e);
View Full Code Here

Examples of com.asakusafw.utils.java.model.util.ImportBuilder

        if (key != null && environment.isResourceGenerated(key)) {
            return;
        }
        ModelFactory f = environment.getFactory();
        PackageDeclaration packageDecl = getPackage(f, operatorClass);
        ImportBuilder imports = getImportBuilder(f, packageDecl);
        OperatorClassGenerator generator = new OperatorFactoryClassGenerator(
                environment,
                f,
                imports,
                operatorClass);
        TypeDeclaration type = generator.generate();
        if (type == null) {
            sawError = true;
            return;
        }
        List<ImportDeclaration> decls = imports.toImportDeclarations();

        try {
            emit(key, f, packageDecl, decls, type, operatorClass.getElement());
        } catch (IOException e) {
            LOG.debug(e.getMessage(), e);
View Full Code Here

Examples of com.asakusafw.utils.java.model.util.ImportBuilder

    private ImportBuilder getImportBuilder(
            ModelFactory factory,
            PackageDeclaration packageDecl) {
        assert factory != null;
        assert packageDecl != null;
        return new ImportBuilder(factory, packageDecl, Strategy.TOP_LEVEL);
    }
View Full Code Here

Examples of com.asakusafw.utils.java.model.util.ImportBuilder

            assert environment != null;
            assert model != null;
            this.model = model;
            this.factory = environment.getModelFactory();
            Name packageName = environment.getStagePackageName(model.getStageBlock().getStageNumber());
            this.importer = new ImportBuilder(
                    factory,
                    factory.newPackageDeclaration(packageName),
                    ImportBuilder.Strategy.TOP_LEVEL);
        }
View Full Code Here

Examples of com.asakusafw.utils.java.model.util.ImportBuilder

            this.factory = envinronment.getModelFactory();
            Name packageName = Models.append(
                    factory,
                    envinronment.getEpiloguePackageName(moduleId),
                    JavaName.of(slot.getSource().getOutputName()).toMemberName());
            this.importer = new ImportBuilder(
                    factory,
                    factory.newPackageDeclaration(packageName),
                    Strategy.TOP_LEVEL);
        }
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. 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.