if (property instanceof NumberSchema) { NumberSchema ap = (NumberSchema) property; ap.setMaximum(new BigDecimal(max.value())); ap.setExclusiveMaximum(!max.inclusive());
maxValue = new BigDecimal(decimalMaxAnnotation.value());
BigDecimal maxValue = NumberUtils.createBigDecimal(((DecimalMax) annotate).value()); BigDecimal actualValue = NumberUtils.createBigDecimal(toString(validationObject)); int res = actualValue.compareTo(maxValue);
@Override public void initialize(DecimalMax annotation) { try { this.maxValue = new BigDecimal(annotation.value()); } catch (NumberFormatException nfe) { throw new IllegalArgumentException(annotation.value() + " does not represent a valid BigDecimal format"); } this.inclusive = annotation.inclusive(); }
@Override public void initialize(DecimalMax annotation) { try { this.maxValue = new BigDecimal(annotation.value()); } catch (NumberFormatException nfe) { throw new IllegalArgumentException(annotation.value() + " does not represent a valid BigDecimal format"); } this.inclusive = annotation.inclusive(); }
@Override public void initialize(DecimalMax constraintAnnotation) { String stringValue = constraintAnnotation.value(); try { this.maxValue = NumberFormatProvider.INSTANCE.getDoubleFromString(stringValue); } catch (Exception ex) { //no valid max value from string } this.maxValueString = String.valueOf(this.maxValue); }
@Override public void initialize(final DecimalMax maxValue) { this.maxValue = new BigDecimal(maxValue.value() ); this.inclusive = maxValue.inclusive(); }
@Override public Double getNumberMaximum(BeanProperty prop) { Max maxAnnotation = prop.getAnnotation(Max.class); if (maxAnnotation != null) { return (double) maxAnnotation.value(); } DecimalMax decimalMaxAnnotation = prop.getAnnotation(DecimalMax.class); return decimalMaxAnnotation != null ? new BigDecimal(decimalMaxAnnotation.value()).doubleValue() : null; }
@Override public Double getNumberMaximum(BeanProperty prop) { Max maxAnnotation = prop.getAnnotation(Max.class); if (maxAnnotation != null) { return (double) maxAnnotation.value(); } DecimalMax decimalMaxAnnotation = prop.getAnnotation(DecimalMax.class); return decimalMaxAnnotation != null ? new BigDecimal(decimalMaxAnnotation.value()).doubleValue() : null; }