org.babyfish.jimmer.sql.ast.impl.LowerExpression Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of jimmer-sql Show documentation
Show all versions of jimmer-sql Show documentation
A revolutionary ORM framework for both java and kotlin
package org.babyfish.jimmer.sql.ast.impl;
import org.babyfish.jimmer.sql.ast.Expression;
import org.babyfish.jimmer.sql.ast.StringExpression;
import org.babyfish.jimmer.sql.ast.impl.render.AbstractSqlBuilder;
import org.jetbrains.annotations.NotNull;
import java.util.Objects;
class LowerExpression extends AbstractExpression implements StringExpressionImplementor {
private Expression raw;
LowerExpression(Expression raw) {
this.raw = raw;
}
@Override
public int precedence() {
return 0;
}
@Override
public void accept(@NotNull AstVisitor visitor) {
((Ast)raw).accept(visitor);
}
@Override
public void renderTo(@NotNull AbstractSqlBuilder> builder) {
builder.sql("lower(");
((Ast)raw).renderTo(builder);
builder.sql(")");
}
@Override
protected boolean determineHasVirtualPredicate() {
return hasVirtualPredicate(raw);
}
@Override
protected Ast onResolveVirtualPredicate(AstContext ctx) {
raw = ctx.resolveVirtualPredicate(raw);
return this;
}
@Override
public StringExpression lower() {
return this;
}
@Override
public boolean equals(Object o) {
if (this == o) return true;
if (o == null || getClass() != o.getClass()) return false;
LowerExpression that = (LowerExpression) o;
return raw.equals(that.raw);
}
@Override
public int hashCode() {
return Objects.hash(raw);
}
}