/** * Retrieves the exclusiveMaximum value of a property * * @return the exclusiveMaximum value of the property */ public boolean getExclusiveMax() { if (property instanceof AbstractNumericProperty) { AbstractNumericProperty numericProperty = (AbstractNumericProperty) property; return BooleanUtils.isTrue((numericProperty.getExclusiveMaximum())); } return false; }
/** * Retrieves the exclusiveMinimum value of a property * * @return the exclusiveMinimum value of the property */ public boolean getExclusiveMin() { if (property instanceof AbstractNumericProperty) { AbstractNumericProperty numericProperty = (AbstractNumericProperty) property; return BooleanUtils.isTrue(numericProperty.getExclusiveMinimum()); } return false; }
/** * Retrieves the minimum value of a property * * @return the minimum value of the property */ public Optional<BigDecimal> getMax() { if (property instanceof BaseIntegerProperty) { BaseIntegerProperty integerProperty = (BaseIntegerProperty) property; return Optional.ofNullable(integerProperty.getMaximum() != null ? integerProperty.getMaximum() : null); } else if (property instanceof AbstractNumericProperty) { AbstractNumericProperty numericProperty = (AbstractNumericProperty) property; return Optional.ofNullable(numericProperty.getMaximum()); } return Optional.empty(); }
protected <N extends AbstractNumericProperty> N mergeNumeric(N property, Map<PropertyId, Object> args) { if (args.containsKey(PropertyId.MINIMUM)) { final BigDecimal value = PropertyId.MINIMUM.findValue(args); if(value != null) { property.setMinimum(value); } } if (args.containsKey(PropertyId.MAXIMUM)) { final BigDecimal value = PropertyId.MAXIMUM.findValue(args); if(value != null) { property.setMaximum(value); } } if (args.containsKey(PropertyId.EXCLUSIVE_MINIMUM)) { final Boolean value = PropertyId.EXCLUSIVE_MINIMUM.findValue(args); property.setExclusiveMinimum(value); } if (args.containsKey(PropertyId.EXCLUSIVE_MAXIMUM)) { final Boolean value = PropertyId.EXCLUSIVE_MAXIMUM.findValue(args); property.setExclusiveMaximum(value); } if (args.containsKey(PropertyId.MULTIPLE_OF)) { final BigDecimal value = PropertyId.MULTIPLE_OF.findValue(args); if(value != null) { property.setMultipleOf(value); } } return property; }
switch (attr) { case "minimum": _switchResult = prop.getMinimum(); break; case "maximum": _switchResult = prop.getMaximum(); break; case "exclusiveMinimum": _switchResult = prop.getExclusiveMinimum(); break; case "exclusiveMaximum": _switchResult = prop.getExclusiveMaximum(); break;
AbstractNumericProperty np = (AbstractNumericProperty) schema; result.setExclusiveMaximum(np.getExclusiveMaximum()); result.setExclusiveMinimum(np.getExclusiveMinimum());
Range range = (Range) annos.get("org.hibernate.validator.constraints.Range"); AbstractNumericProperty ap = (AbstractNumericProperty) property; ap.setMinimum(new BigDecimal(range.min())); ap.setMaximum(new BigDecimal(range.max()));
protected DataProvider collectNumericProperty(Swagger swagger, AbstractNumericProperty schema, boolean clean) { long min = schema.getMinimum() != null ? schema.getMinimum().longValue() : Long.MIN_VALUE; long max = schema.getMaximum() != null ? schema.getMaximum().longValue() : Long.MAX_VALUE; boolean noBetween = (min == Long.MIN_VALUE && max == Long.MAX_VALUE); if (schema instanceof BaseIntegerProperty) return gen(() -> noBetween ? faker.number().randomNumber() : faker.number().numberBetween(min, max)); else if (schema instanceof DecimalProperty) return gen(() -> faker.number().randomDouble(10, min, max)); throw new IllegalArgumentException("Unsupported property type: " + schema.getClass()); }
public AbstractNumericProperty maximum(BigDecimal maximum) { this.setMaximum(maximum); return this; }
public AbstractNumericProperty minimum(BigDecimal minimum) { this.setMinimum(minimum); return this; }
/** * Retrieves the minimum value of a property * * @return the minimum value of the property */ public Optional<BigDecimal> getMin() { if (property instanceof BaseIntegerProperty) { BaseIntegerProperty integerProperty = (BaseIntegerProperty) property; return Optional.ofNullable(integerProperty.getMinimum() != null ? integerProperty.getMinimum() : null); } else if (property instanceof AbstractNumericProperty) { AbstractNumericProperty numericProperty = (AbstractNumericProperty) property; return Optional.ofNullable(numericProperty.getMinimum()); } return Optional.empty(); }
public AbstractNumericProperty exclusiveMinimum(Boolean exclusiveMinimum) { this.setExclusiveMinimum(exclusiveMinimum); return this; }
public AbstractNumericProperty exclusiveMaximum(Boolean exclusiveMaximum) { this.setExclusiveMaximum(exclusiveMaximum); return this; }
String _minValue_1 = it.getMinValue(); BigDecimal _bigDecimal = new BigDecimal(_minValue_1); ((AbstractNumericProperty)property).setMinimum(_bigDecimal); ((AbstractNumericProperty)property).setExclusiveMinimum(Boolean.valueOf(it.isMinValueExclusive())); String _maxValue_1 = it.getMaxValue(); BigDecimal _bigDecimal_1 = new BigDecimal(_maxValue_1); ((AbstractNumericProperty)property).setMaximum(_bigDecimal_1); ((AbstractNumericProperty)property).setExclusiveMaximum(Boolean.valueOf(it.isMaxValueExclusive()));
model.setMaximum(numericProperty.getMaximum()); model.setMinimum(numericProperty.getMinimum()); model.setExclusiveMaximum(numericProperty.getExclusiveMaximum()); model.setExclusiveMinimum(numericProperty.getExclusiveMinimum()); model.setMultipleOf(numericProperty.getMultipleOf());
AbstractNumericProperty np = (AbstractNumericProperty) schema; result.setExclusiveMaximum(np.getExclusiveMaximum()); result.setExclusiveMinimum(np.getExclusiveMinimum());
if (methodParameter.isAnnotationPresent(Min.class)) { Min min = methodParameter.getAnnotation(Min.class); numericProperty.setMinimum(BigDecimal.valueOf(min.value())); numericProperty.setMaximum(BigDecimal.valueOf(max.value())); numericProperty.setMinimum(BigDecimal.valueOf(range.min())); numericProperty.setMaximum(BigDecimal.valueOf(range.max()));
/** * Retrieves the minimum value of a property * * @return the minimum value of the property */ public Optional<BigDecimal> getMin() { if (property instanceof BaseIntegerProperty) { BaseIntegerProperty integerProperty = (BaseIntegerProperty) property; return Optional.ofNullable(integerProperty.getMinimum() != null ? integerProperty.getMinimum() : null); } else if (property instanceof AbstractNumericProperty) { AbstractNumericProperty numericProperty = (AbstractNumericProperty) property; return Optional.ofNullable(numericProperty.getMinimum()); } return Optional.empty(); }
if (schema instanceof AbstractNumericProperty) { (((AbstractNumericProperty) schema)) .setMinimum(new BigDecimal(validatorDescriptor.getMin().doubleValue())); (((AbstractNumericProperty) schema)).setExclusiveMinimum(validatorDescriptor.isExclusiveMin()); } else if (schema instanceof StringProperty) { ((StringProperty) schema) if (schema instanceof AbstractNumericProperty) { (((AbstractNumericProperty) schema)) .setMaximum(new BigDecimal(validatorDescriptor.getMax().doubleValue())); (((AbstractNumericProperty) schema)).setExclusiveMaximum(validatorDescriptor.isExclusiveMax()); } else if (schema instanceof StringProperty) { ((StringProperty) schema)
AbstractNumericProperty np = (AbstractNumericProperty) schema; result.setExclusiveMaximum(np.getExclusiveMaximum()); result.setExclusiveMinimum(np.getExclusiveMinimum());