top.openyuan.jpa.specification.handler.impl.IsNullPredicateHandler Maven / Gradle / Ivy
package top.openyuan.jpa.specification.handler.impl;
import top.openyuan.jpa.specification.annotation.IsNull;
import top.openyuan.jpa.specification.handler.AbstractPredicateHandler;
import javax.persistence.criteria.CriteriaBuilder;
import javax.persistence.criteria.From;
import javax.persistence.criteria.Predicate;
import java.lang.annotation.Annotation;
/**
* 构建“是 NULL 条件”({@code field IS NULL})场景的 {@link Predicate} 处理器.
*
* @author lzy
* @since v1.0.0
*/
public class IsNullPredicateHandler extends AbstractPredicateHandler {
@Override
public Class getAnnotation() {
return IsNull.class;
}
@Override
public Predicate buildPredicate(
CriteriaBuilder criteriaBuilder, From from, String name, Object value, Annotation annotation) {
return criteriaBuilder.and(super.buildIsNullPredicate(criteriaBuilder, from, value));
}
}