cn.org.atool.fluent.mybatis.ifs.InIfs Maven / Gradle / Ivy
package cn.org.atool.fluent.mybatis.ifs;
import java.util.Collection;
import java.util.function.Predicate;
/**
* 对 IN collection进行条件选择
*
* @author wudarui
*/
@SuppressWarnings("all")
public class InIfs extends Ifs {
public InIfs when(Predicate predicate, T... values) {
this.predicates.add(new IfsPredicate(predicate, values));
return this;
}
public InIfs other(T... values) {
this.predicates.add(new IfsPredicate(v -> true, values));
return this;
}
@Override
public InIfs when(Predicate predicate, Collection value) {
this.predicates.add(new IfsPredicate(predicate, value == null ? null : value.toArray()));
return this;
}
@Override
public InIfs other(Collection value) {
return this.when(v -> true, value);
}
}