com.github.houbb.valid.jsr.constraint.MaxConstraint Maven / Gradle / Ivy
package com.github.houbb.valid.jsr.constraint;
import com.github.houbb.heaven.annotation.ThreadSafe;
import com.github.houbb.heaven.util.lang.NumUtil;
import com.github.houbb.valid.core.api.constraint.AbstractLessThanConstraint;
/**
* 元素 max 约束
* (1)value 必须小于等于 max
* @author binbin.hou
* @since 0.0.3
*/
@ThreadSafe
class MaxConstraint extends AbstractLessThanConstraint {
public MaxConstraint(boolean inclusive, Long expect) {
super(inclusive, expect);
}
public MaxConstraint(Long expect) {
super(expect);
}
@Override
protected Long formatValue(Object contextValue) {
return NumUtil.parseLong(contextValue);
}
}