org.mybatis.dynamic.sql.where.condition.IsBetween Maven / Gradle / Ivy
/**
* Copyright 2016-2017 the original author or authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package org.mybatis.dynamic.sql.where.condition;
import java.util.function.Supplier;
import org.mybatis.dynamic.sql.AbstractTwoValueCondition;
public class IsBetween extends AbstractTwoValueCondition {
protected IsBetween(Builder builder) {
super(builder.valueSupplier1, builder.valueSupplier2);
}
@Override
public String renderCondition(String columnName, String placeholder1, String placeholder2) {
return columnName + " between " + placeholder1 + " and " + placeholder2; //$NON-NLS-1$ //$NON-NLS-2$
}
public static class Builder {
private Supplier valueSupplier1;
private Supplier valueSupplier2;
private Builder(Supplier valueSupplier1) {
this.valueSupplier1 = valueSupplier1;
}
public IsBetween and(Supplier valueSupplier2) {
this.valueSupplier2 = valueSupplier2;
return new IsBetween<>(this);
}
public IsBetween and(T value2) {
return and(() -> value2);
}
}
public static Builder isBetween(Supplier valueSupplier) {
return new Builder<>(valueSupplier);
}
}
© 2015 - 2025 Weber Informatics LLC | Privacy Policy