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

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


                Collections.singletonList(new ExpressionBuilder(factory, result)
                    .toReturnStatement()));
    }

    private MethodDeclaration createCreateValueObject() {
        Expression result = new TypeBuilder(factory, importer.toType(resource.getMasterDataClass().getType()))
            .newObject()
            .toExpression();
        return factory.newMethodDeclaration(
                null,
                new AttributeBuilder(factory)
View Full Code Here


            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

            cases.add(f.newSwitchCaseLabel(f.newSimpleName(constant.name())));
            cases.add(next.createAdd(context.getInput()));
            cases.add(f.newBreakStatement());
        }
        cases.add(f.newSwitchDefaultLabel());
        cases.add(new TypeBuilder(f, context.convert(AssertionError.class))
            .newObject(branch)
            .toThrowStatement());
        context.add(f.newSwitchStatement(branch, cases));
    }
View Full Code Here

            cases.add(f.newSwitchCaseLabel(f.newSimpleName(constant.name())));
            cases.add(next.createAdd(context.getProcessInput(tx)));
            cases.add(f.newBreakStatement());
        }
        cases.add(f.newSwitchDefaultLabel());
        cases.add(new TypeBuilder(f, context.convert(AssertionError.class))
            .newObject(branch)
            .toThrowStatement());
        context.addProcess(tx, f.newSwitchStatement(branch, cases));
    }
View Full Code Here

    @Override
    protected List<? extends TypeBodyDeclaration> override(Context context) {
        ImplementationBuilder builder = new ImplementationBuilder(context);
        ModelFactory f = context.environment.getFactory();
        builder.addStatement(new TypeBuilder(f, context.importer.toType(UnsupportedOperationException.class))
            .newObject(Models.toLiteral(f, "マスタ結合演算子は組み込みの方法で処理されます"))
            .toThrowStatement());
        return builder.toImplementation();
    }
View Full Code Here

         * @return 生成した式
         */
        public Expression createImplementation() {
            Class<?> implementing = description.getDeclaration().getImplementing();
            Type type = convert(implementing);
            return addField(type, "op", new TypeBuilder(factory, type)
                .newObject()
                .toExpression());
        }
View Full Code Here

                    Models.toType(factory, bufferType),
                    Collections.singletonList(elementType)));
            Expression list = addField(
                    listType,
                    "list",
                    new TypeBuilder(factory, listType)
                        .newObject()
                        .toExpression());
            DataClass component = environment.getDataClasses().load(type);
            if (component == null) {
                environment.error("{0}のデータモデルを解析できませんでした", type);
View Full Code Here

            statements.add(factory.newIfStatement(
                    new ExpressionBuilder(factory, factory.newThis())
                        .field(SEGMENT_ID_FIELD_NAME)
                        .apply(InfixOperator.NOT_EQUALS, v(segment.getPortId()))
                        .toExpression(),
                    new TypeBuilder(factory, t(AssertionError.class))
                        .newObject()
                        .toThrowStatement(),
                    null));

            statements.add(new ExpressionBuilder(factory, factory.newThis())
View Full Code Here

                            .toExpression(),
                        out));
                cases.add(factory.newBreakStatement());
            }
            cases.add(factory.newSwitchDefaultLabel());
            cases.add(new TypeBuilder(factory, t(AssertionError.class))
                .newObject(segmentId)
                .toThrowStatement());

            List<Statement> statements = Lists.create();
            statements.add(factory.newSwitchStatement(segmentId, cases));
View Full Code Here

                            .toExpression(),
                        in));
                cases.add(factory.newBreakStatement());
            }
            cases.add(factory.newSwitchDefaultLabel());
            cases.add(new TypeBuilder(factory, t(AssertionError.class))
                .newObject(segmentId)
                .toThrowStatement());

            statements.add(factory.newSwitchStatement(segmentId, cases));
View Full Code Here

TOP

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

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.