Package com.asakusafw.utils.java.model.util

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


            this.moduleId = moduleId;
            this.slots = slots;
            this.outputDirectory = outputDirectory;
            this.factory = environment.getModelFactory();
            Name packageName = environment.getEpiloguePackageName(moduleId);
            this.importer = new ImportBuilder(
                    factory,
                    factory.newPackageDeclaration(packageName),
                    ImportBuilder.Strategy.TOP_LEVEL);
        }
View Full Code Here


            this.reduceUnits = model.getReduceUnits();
            this.shuffle = model.getShuffleModel();
            this.factory = environment.getModelFactory();
            Name packageName = environment.getStagePackageName(
                    model.getStageBlock().getStageNumber());
            this.importer = new ImportBuilder(
                    factory,
                    factory.newPackageDeclaration(packageName),
                    ImportBuilder.Strategy.TOP_LEVEL);
            this.names = new NameGenerator(factory);
            this.context = names.create("context");
View Full Code Here

                    factory,
                    prologue
                        ? envinronment.getProloguePackageName(moduleId)
                        : envinronment.getEpiloguePackageName(moduleId),
                    JavaName.of(slot.getName()).toMemberName());
            this.importer = new ImportBuilder(
                    factory,
                    factory.newPackageDeclaration(packageName),
                    Strategy.TOP_LEVEL);
        }
View Full Code Here

            assert slots != null;
            this.slots = slots;
            this.environment = envinronment;
            this.moduleId = moduleId;
            this.factory = envinronment.getModelFactory();
            this.importer = new ImportBuilder(
                    factory,
                    factory.newPackageDeclaration(envinronment.getEpiloguePackageName(moduleId)),
                    Strategy.TOP_LEVEL);
        }
View Full Code Here

            this.prologue = prologue;
            this.factory = environment.getModelFactory();
            Name packageName = prologue
                ? environment.getProloguePackageName(moduleId)
                : environment.getEpiloguePackageName(moduleId);
            this.importer = new ImportBuilder(
                    factory,
                    factory.newPackageDeclaration(packageName),
                    ImportBuilder.Strategy.TOP_LEVEL);
        }
View Full Code Here

            this.stageBlock = stageBlock;
            this.fragment = fragment;
            this.shuffle = shuffle;
            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.valueType = importer.resolve(factory.newNamedType(
View Full Code Here

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

            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

         * @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

         * @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

TOP

Related Classes of com.asakusafw.utils.java.model.util.ImportBuilder

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.