package org.dayatang.domain.internal.criterion; import org.apache.commons.lang3.builder.EqualsBuilder; import org.apache.commons.lang3.builder.HashCodeBuilder; import org.dayatang.domain.NamedParameters; /** * 判断某个集合属性值是否为空集合的查询条件 * @author yyang */ public class IsEmptyCriterion extends BasicCriterion { public IsEmptyCriterion(String propName) { super(propName); } @Override public String toQueryString() { return getPropNameWithAlias() + " is empty"; } @Override public NamedParameters getParameters() { return NamedParameters.create(); } @Override public boolean equals(final Object other) { if (this == other) { return true; } if (!(other instanceof IsEmptyCriterion)) { return false; } IsEmptyCriterion that = (IsEmptyCriterion) other; return new EqualsBuilder() .append(this.getPropName(), that.getPropName()) .isEquals(); } @Override public int hashCode() { return new HashCodeBuilder(17, 37).append(getPropName()).toHashCode(); } @Override public String toString() { return getPropName() + " is empty"; } }