cn.org.atool.fluent.mybatis.ifs.Ifs Maven / Gradle / Ivy
package cn.org.atool.fluent.mybatis.ifs;
import lombok.AccessLevel;
import lombok.Getter;
import java.util.ArrayList;
import java.util.List;
import java.util.function.Predicate;
/**
* 分支设置
*
* @param
* @author wudarui
*/
@Getter
public class Ifs {
/**
* 选择分支
*/
@Getter(AccessLevel.NONE)
public final List predicates = new ArrayList<>();
public Ifs() {
}
public Ifs when(Predicate predicate, T value) {
this.predicates.add(new IfsPredicate(predicate, value));
return this;
}
public Ifs other(T value) {
return this.when(v -> true, value);
}
}