![JAR search and dependency download from the Maven repository](/logo.png)
com.github.houbb.valid.jsr.constraint.DigitsBigDecimalConstraint Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of valid-jsr Show documentation
Show all versions of valid-jsr Show documentation
The jsr-303 module for valid framework.
package com.github.houbb.valid.jsr.constraint;
import com.github.houbb.heaven.annotation.ThreadSafe;
import java.math.BigDecimal;
/**
* {@link javax.validation.constraints.Digits} 约束注解实现
* @author binbin.hou
* @since 0.0.3
* @see BigDecimal
*/
@ThreadSafe
class DigitsBigDecimalConstraint extends AbstractDigitsConstraint {
public DigitsBigDecimalConstraint(int integer, int fraction) {
super(integer, fraction);
}
public DigitsBigDecimalConstraint(int integer) {
super(integer);
}
/**
* 用整体精度位数-小数位数
* @param value 值
* @return 整数位数
*/
@Override
protected int getIntegerDigits(BigDecimal value) {
return value.precision() - value.scale();
}
@Override
protected int getFractionDigits(BigDecimal value) {
return value.scale();
}
}
© 2015 - 2025 Weber Informatics LLC | Privacy Policy