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

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


                    }));
            return decl;
        }

        private MethodDeclaration createGetPreferredFragmentSize() {
            Expression value = Models.toLiteral(f, -1L);
            return f.newMethodDeclaration(
                    null,
                    new AttributeBuilder(f)
                        .annotation(context.resolve(Override.class))
                        .Public()
View Full Code Here


                    Collections.singletonList(new ExpressionBuilder(f, value).toReturnStatement()));
        }

        private MethodDeclaration createGetMinimumFragmentSize() {
            boolean fastMode = isFastMode();
            Expression value = fastMode
                ? new TypeBuilder(f, context.resolve(Long.class)).field("MAX_VALUE").toExpression()
                : Models.toLiteral(f, -1);
            return f.newMethodDeclaration(
                    null,
                    new AttributeBuilder(f)
View Full Code Here

            SimpleName fragmentSize = f.newSimpleName("fragmentSize");
            List<Statement> statements = Lists.create();
            statements.add(createNullCheck(dataType));
            statements.add(createNullCheck(path));
            statements.add(createNullCheck(stream));
            Expression isNotHead = new ExpressionBuilder(f, offset)
                .apply(InfixOperator.GREATER, Models.toLiteral(f, 0L))
                .toExpression();
            if (isFastMode() == false) {
                statements.add(f.newIfStatement(
                        isNotHead,
View Full Code Here

                    f.newBlock(statements));
            return decl;
        }

        private Expression blessInputStream(SimpleName stream) {
            Expression codec = createCompressionCodec();
            if (codec == null) {
                return stream;
            }
            return new ExpressionBuilder(f, codec)
                .method("createInputStream", stream)
View Full Code Here

                .method("createInputStream", stream)
                .toExpression();
        }

        private Expression blessOutputStream(SimpleName stream) {
            Expression codec = createCompressionCodec();
            if (codec == null) {
                return stream;
            }
            return new ExpressionBuilder(f, codec)
                .method("createOutputStream", stream)
View Full Code Here

            results.add(createGetFormatConfigurationMethod());
            return results;
        }

        private MethodDeclaration createGetTableNameMethod() {
            Expression value = Models.toLiteral(f, ParquetFileTrait.getTableName(model));
            return createMethod("getTableName", context.resolve(String.class), value); //$NON-NLS-1$
        }
View Full Code Here

            return createMethod("getTableName", context.resolve(String.class), value); //$NON-NLS-1$
        }

        private MethodDeclaration createGetDataModelDescriptorMethod() {
            Name factory = HiveDataModelEmitter.getClassName(context, model);
            Expression value = new TypeBuilder(f, context.resolve(factory))
                .method(HiveDataModelEmitter.NAME_GETTER_METHOD)
                .toExpression();
            return createMethod(
                    "getDataModelDescriptor", //$NON-NLS-1$
                    context.resolve(DataModelDescriptor.class),
View Full Code Here

                .toLocalVariableDeclaration(t(Map.class, t(String.class), t(String.class)), attributes));

            Type formatType = t(BridgeOutputFormat.class);
            for (CompiledSlot slot : slots) {
                Slot origin = slot.original;
                Expression valueType = factory.newClassLiteral(importer.toType(origin.valueType));
                statements.add(new ExpressionBuilder(factory, attributes)
                    .assignFrom(new TypeBuilder(factory, t(HashMap.class, t(String.class), t(String.class)))
                        .newObject()
                        .toExpression())
                    .toStatement());
View Full Code Here

        List<Expression> arguments = Lists.create();
        for (String element : values) {
            arguments.add(Models.toLiteral(f, element));
        }
        Type type = f.newParameterizedType(context.resolve(List.class), context.resolve(String.class));
        Expression value = new TypeBuilder(f, context.resolve(Arrays.class))
            .method("asList", arguments) //$NON-NLS-1$
            .toExpression();
        return createGetMethod(name, type, value);
    }
View Full Code Here

public class TraceFlowProcessor extends LinePartProcessor {

    @Override
    public void emitLinePart(Context context) {
        ModelFactory f = Models.getModelFactory();
        Expression driver = context.createField(
                TraceDriver.class, "trace",
                new TypeBuilder(f, context.convert(TraceDriver.class))
                    .method("get", createTraceContext(context))
                    .toExpression());

        Expression input = context.getInput();
        context.add(new ExpressionBuilder(f, driver).method("trace", input).toStatement());
        context.setOutput(input);
    }
View Full Code Here

TOP

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

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.