All Downloads are FREE. Search and download functionalities are using the official Maven repository.

org.babyfish.jimmer.sql.ast.impl.ConcatExpression Maven / Gradle / Ivy

There is a newer version: 0.8.180
Show newest version
package org.babyfish.jimmer.sql.ast.impl;

import org.babyfish.jimmer.sql.ast.Expression;
import org.babyfish.jimmer.sql.runtime.SqlBuilder;

import java.util.List;

class ConcatExpression
        extends AbstractExpression
        implements StringExpressionImplementor {

    private Expression first;

    private List> others;

    ConcatExpression(Expression first, List> others) {
        this.first = first;
        this.others = others;
    }

    @Override
    public void accept(AstVisitor visitor) {
        ((Ast) first).accept(visitor);
        for (Expression other : others) {
            ((Ast) other).accept(visitor);
        }
    }

    @Override
    public void renderTo(SqlBuilder builder) {
        builder.sql("concat(");
        renderChild((Ast) first, builder);
        for (Expression other : others) {
            builder.sql(", ");
            renderChild((Ast) other, builder);
        }
        builder.sql(")");
    }

    @Override
    public int precedence() {
        return 0;
    }
}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy