io.ebeaninternal.server.expression.NoopExpression Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of ebean Show documentation
Show all versions of ebean Show documentation
composite of common runtime dependencies for all platforms
package io.ebeaninternal.server.expression;
import io.ebean.event.BeanQueryRequest;
import io.ebeaninternal.api.HashQueryPlanBuilder;
import io.ebeaninternal.api.ManyWhereJoins;
import io.ebeaninternal.api.SpiExpression;
import io.ebeaninternal.api.SpiExpressionRequest;
import io.ebeaninternal.api.SpiExpressionValidation;
import io.ebeaninternal.server.deploy.BeanDescriptor;
import java.io.IOException;
/**
* Effectively an expression that has no effect.
*/
class NoopExpression implements SpiExpression {
protected static final NoopExpression INSTANCE = new NoopExpression();
@Override
public void simplify() {
// do nothing
}
@Override
public SpiExpression copyForPlanKey() {
return this;
}
@Override
public void writeDocQuery(DocQueryContext context) throws IOException {
}
@Override
public Object getIdEqualTo(String idName) {
// always return null for this expression
return null;
}
@Override
public String nestedPath(BeanDescriptor> desc) {
return null;
}
@Override
public void containsMany(BeanDescriptor> desc, ManyWhereJoins whereManyJoins) {
// nothing to do
}
@Override
public void validate(SpiExpressionValidation validation) {
// always valid
}
@Override
public void prepareExpression(BeanQueryRequest> request) {
// do nothing
}
@Override
public void queryPlanHash(HashQueryPlanBuilder builder) {
builder.add(NoopExpression.class);
}
@Override
public int queryBindHash() {
// no bind values
return 0;
}
@Override
public void addSql(SpiExpressionRequest request) {
request.append("1=1");
}
@Override
public void addBindValues(SpiExpressionRequest request) {
// nothing to do
}
@Override
public boolean isSameByPlan(SpiExpression other) {
return other instanceof NoopExpression;
}
@Override
public boolean isSameByBind(SpiExpression other) {
return true;
}
}
© 2015 - 2025 Weber Informatics LLC | Privacy Policy