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

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


        }

        private ConstructorDeclaration createConstructor() {
            List<Expression> arguments = Lists.create();
            for (CompiledOrder order : orderingInfo) {
                Expression arg = order.getTarget().createNewInstance(t(order.getTarget().getType()));
                if (order.isAscend() == false) {
                    arg = new TypeBuilder(factory, t(InvertOrder.class))
                        .newObject(arg)
                        .toExpression();
                }
                arguments.add(arg);
            }
            List<Statement> statements = Lists.create();
            statements.add(factory.newSuperConstructorInvocation(arguments));
            int position = 0;
            for (CompiledOrder order : orderingInfo) {
                Expression obj = new ExpressionBuilder(factory, factory.newThis())
                    .method("get", Models.toLiteral(factory, position))
                    .toExpression();
                if (order.isAscend() == false) {
                    Expression invert = factory.newParenthesizedExpression(new ExpressionBuilder(factory, obj)
                        .castTo(t(InvertOrder.class))
                        .toExpression());
                    obj = new ExpressionBuilder(factory, invert)
                        .method("getEntity")
                        .toExpression();
View Full Code Here


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

        private MethodDeclaration createGetTableNameMethod() {
            Expression value = Models.toLiteral(f, OrcFileTrait.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

public class OriginalNameEmitter extends JavaDataModelDriver {

    @Override
    public List<Annotation> getTypeAnnotations(EmitContext context, ModelDeclaration model) {
        ModelFactory f = context.getModelFactory();
        Expression value = Models.toLiteral(f, getOriginalName(model));
        return new AttributeBuilder(f)
            .annotation(context.resolve(OriginalName.class), "value", value)
            .toAnnotations();
    }
View Full Code Here

        if (trait == null) {
            return Collections.emptyList();
        }

        ModelFactory f = context.getModelFactory();
        Expression value = Models.toLiteral(f, trait.getName());
        return new AttributeBuilder(f)
            .annotation(context.resolve(OriginalName.class), "value", value)
            .toAnnotations();
    }
View Full Code Here

        assert context != null;
        assert model != null;
        assert deleteFlagValue != null;
        ModelFactory f = context.getModelFactory();
        Type type;
        Expression value;
        switch (deleteFlagValue.kind) {
        case BOOLEAN:
            type = context.resolve(boolean.class);
            value = Models.toLiteral(f, deleteFlagValue.toBooleanValue());
            break;
View Full Code Here

    protected Statement createCopierFor(
            Expression fromObject,
            String fromName,
            String toName,
            PropertyType type) {
        Expression to = new ExpressionBuilder(f, f.newThis())
            .field(common.getFieldNameOf(toName, type))
            .toExpression();
        Expression from = new ExpressionBuilder(f, fromObject)
            .field(common.getFieldNameOf(fromName, type))
            .toExpression();
        return new ExpressionBuilder(f, to)
            .method(Constants.NAME_OPTION_COPIER, from)
            .toStatement();
View Full Code Here

    protected Statement createImporterFor(
            Expression fromObject,
            String fromName,
            String toName,
            PropertyType type) {
        Expression to = f.newFieldAccessExpression(
                f.newThis(),
                common.getFieldNameOf(toName, type));
        if (fromObject == null || fromName == null) {
            return new ExpressionBuilder(f, to)
                .method(Constants.NAME_OPTION_ERASER)
                .toStatement();
        } else {
            Expression from = new ExpressionBuilder(f, fromObject)
                .method(common.getOptionGetterNameOf(fromName, type))
                .toExpression();
            return new ExpressionBuilder(f, to)
                .method(Constants.NAME_OPTION_COPIER, from)
                .toStatement();
View Full Code Here

    protected Statement createExporterFor(
            String fromName,
            Expression toObject,
            String toName,
            PropertyType type) {
        Expression from = new ExpressionBuilder(f, f.newThis())
            .field(common.getFieldNameOf(fromName, type))
            .toExpression();
        Expression to = new ExpressionBuilder(f, toObject)
            .method(common.getOptionGetterNameOf(toName, type))
            .toExpression();
        return new ExpressionBuilder(f, to)
            .method(Constants.NAME_OPTION_COPIER, from)
            .toStatement();
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.