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

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


                    factory.newSimpleName(SEGMENT_ID_FIELD_NAME),
                    v(-1));
        }

        private TypeBodyDeclaration createSegmentIdGetter() {
            Statement body = new ExpressionBuilder(factory, factory.newThis())
                .field(SEGMENT_ID_FIELD_NAME)
                .toReturnStatement();
            return factory.newMethodDeclaration(
                    null,
                    new AttributeBuilder(factory)
View Full Code Here


    public static MethodDeclaration createCompareInts(
            ModelFactory factory) {
        SimpleName a = factory.newSimpleName("a");
        SimpleName b = factory.newSimpleName("b");
        Statement statement = factory.newIfStatement(
                new ExpressionBuilder(factory, a)
                    .apply(InfixOperator.EQUALS, b)
                    .toExpression(),
                new ExpressionBuilder(factory, Models.toLiteral(factory, 0))
                    .toReturnStatement(),
View Full Code Here

        }
        cases.add(factory.newSwitchDefaultLabel());
        cases.add(factory.newReturnStatement(Models.toLiteral(factory, -1)));

        SimpleName pid = factory.newSimpleName("pid");
        Statement statement = factory.newSwitchStatement(pid, cases);
        return factory.newMethodDeclaration(
                null,
                new AttributeBuilder(factory)
                    .Private()
                    .toAttributes(),
View Full Code Here

                    factory.newSimpleName(PORT_ID_FIELD_NAME),
                    v(-1));
        }

        private TypeBodyDeclaration createSegmentIdGetter() {
            Statement body = new ExpressionBuilder(factory, factory.newThis())
                .field(PORT_ID_FIELD_NAME)
                .toReturnStatement();
            return factory.newMethodDeclaration(
                    null,
                    new AttributeBuilder(factory)
View Full Code Here

            return null;
        }

        @Override
        public Statement reset(Expression object) {
            Statement statement = factory.newEmptyStatement();
            statement.putModelTrait(CommentEmitTrait.class, new CommentEmitTrait(Arrays.asList(
                    MessageFormat.format(
                            "Failed to resolve in \"reset\": {0}",
                            runtimeType)
            )));
            return statement;
View Full Code Here

            return expression;
        }

        @Override
        public Statement assign(Expression target, Expression source) {
            Statement statement = factory.newEmptyStatement();
            statement.putModelTrait(CommentEmitTrait.class, new CommentEmitTrait(Arrays.asList(
                    MessageFormat.format(
                            "Failed to resolve in \"assign\": {0}",
                            runtimeType)
            )));
            return statement;
View Full Code Here

            return statement;
        }

        @Override
        public Statement createWriter(Expression object, Expression dataOutput) {
            Statement statement = factory.newEmptyStatement();
            statement.putModelTrait(CommentEmitTrait.class, new CommentEmitTrait(Arrays.asList(
                    MessageFormat.format(
                            "Failed to resolve in \"createWriter\": {0}",
                            runtimeType)
            )));
            return statement;
View Full Code Here

            return statement;
        }

        @Override
        public Statement createReader(Expression object, Expression dataInput) {
            Statement statement = factory.newEmptyStatement();
            statement.putModelTrait(CommentEmitTrait.class, new CommentEmitTrait(Arrays.asList(
                    MessageFormat.format(
                            "Failed to resolve in \"createReader\": {0}",
                            runtimeType)
            )));
            return statement;
View Full Code Here

            List<? extends Expression> arguments) throws IOException {
        assert className != null;
        assert importer != null;
        assert arguments != null;
        ModelFactory f = environment.getModelFactory();
        Statement ctorChain = f.newSuperConstructorInvocation(arguments);
        ConstructorDeclaration ctorDecl = f.newConstructorDeclaration(
                new JavadocBuilder(f)
                    .text("Creates a new instance.")
                    .toJavadoc(),
                new AttributeBuilder(f)
View Full Code Here

            assert property != null;
            SimpleName optionGetterName = context.getOptionGetterName(property);
            Expression option = new ExpressionBuilder(f, createModelParameterName())
                .method(optionGetterName)
                .toExpression();
            Statement fill = new ExpressionBuilder(f, createParserFieldName())
                .method("fill", option)
                .toStatement();
            return fill;
        }
View Full Code Here

TOP

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

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.