Java javax.validation.constraints.DecimalMin 代码实例

・3 分钟阅读

以下是展示如何使用javax.validation.constraints.DecimalMin的最佳示例。 我们使用了代码质量辨别算法从开源项目中提取出了最佳的优秀示例。

实例 1


public final void initialize(DecimalMin constraintAnnotation) {
  try {
    min = new BigDecimal(constraintAnnotation.value());
  } catch (NumberFormatException e) {
    throw new IllegalArgumentException(constraintAnnotation.value()
        + " does not represent a valid BigDecimal format", e);
  }
}
 

实例 2


@Override
public final void initialize(DecimalMin constraintAnnotation) {
  try {
    min = new BigDecimal(constraintAnnotation.value());
  } catch (NumberFormatException e) {
    throw new IllegalArgumentException(constraintAnnotation.value()
        + " does not represent a valid BigDecimal format", e);
  }
}
 

实例 3


public final void initialize(DecimalMin constraintAnnotation) {
  try {
    min = new BigDecimal(constraintAnnotation.value());
  } catch (NumberFormatException e) {
    throw new IllegalArgumentException(constraintAnnotation.value()
        + " does not represent a valid BigDecimal format", e);
  }
}
 

实例 4


public void initialize(DecimalMin minValue) {
        try {
                this.minValue = new BigDecimal( minValue.value() );
        }
        catch ( NumberFormatException nfe ) {
                throw log.getInvalidBigDecimalFormatException( minValue.value(), nfe );
        }
        this.inclusive = minValue.inclusive();
}
 

实例 5


public void initialize(DecimalMin minValue) {
        try {
                this.minValue = new BigDecimal( minValue.value() );
        }
        catch ( NumberFormatException nfe ) {
                throw log.getInvalidBigDecimalFormatException( minValue.value(), nfe );
        }
        this.inclusive = minValue.inclusive();
}
 

实例 6


@Override
public final void initialize(DecimalMin constraintAnnotation) {
  try {
    min = new BigDecimal(constraintAnnotation.value());
  } catch (NumberFormatException e) {
    throw new IllegalArgumentException(constraintAnnotation.value()
        + " does not represent a valid BigDecimal format", e);
  }
}
 
讨论
淘淘あ西西 profile image