org.babyfish.jimmer.sql.ast.impl.OptimisticLockNewValueExpression 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
The newest version!
package org.babyfish.jimmer.sql.ast.impl;
import org.babyfish.jimmer.meta.ImmutableProp;
import org.babyfish.jimmer.meta.TypedProp;
import org.babyfish.jimmer.sql.ast.impl.render.AbstractSqlBuilder;
import org.babyfish.jimmer.sql.ast.impl.render.BatchSqlBuilder;
import org.jetbrains.annotations.NotNull;
class OptimisticLockNewValueExpression
extends AbstractExpression {
private final ImmutableProp prop;
OptimisticLockNewValueExpression(ImmutableProp prop) {
this.prop = prop;
}
@Override
protected boolean determineHasVirtualPredicate() {
return false;
}
@Override
protected Ast onResolveVirtualPredicate(AstContext ctx) {
return this;
}
@Override
public void accept(@NotNull AstVisitor visitor) {
}
@Override
public void renderTo(@NotNull AbstractSqlBuilder> builder) {
if (!(builder instanceof BatchSqlBuilder)) {
throw new IllegalStateException(
"The \"" +
OptimisticLockNewValueExpression.class.getName() +
"\" does not accept simple sql builder"
);
}
((BatchSqlBuilder)builder).value(prop);
}
@SuppressWarnings("unchecked")
@Override
public Class getType() {
return (Class) prop.getReturnClass();
}
@Override
public int precedence() {
return 0;
}
static class Str extends OptimisticLockNewValueExpression implements StringExpressionImplementor {
Str(ImmutableProp prop) {
super(prop);
}
}
static class Num> extends OptimisticLockNewValueExpression implements NumericExpressionImplementor {
Num(ImmutableProp prop) {
super(prop);
}
}
static class Cmp> extends OptimisticLockNewValueExpression implements ComparableExpressionImplementor {
Cmp(ImmutableProp prop) {
super(prop);
}
}
}