/** * Set {@literal maximum} to given {@code max} value and {@literal exclusiveMaximum} to {@literal true}. * * @param max must not be {@literal null}. * @return new instance of {@link NumericJsonSchemaObject}. */ @SuppressWarnings("unchecked") public NumericJsonSchemaObject lt(Number max) { Assert.notNull(max, "Max must not be null!"); Bound lower = this.range != null ? this.range.getLowerBound() : Bound.unbounded(); return within(Range.of(lower, createBound(max, false))); }
/** * Set {@literal maximum} to given {@code max} value and {@literal exclusiveMaximum} to {@literal false}. * * @param max must not be {@literal null}. * @return new instance of {@link NumericJsonSchemaObject}. */ @SuppressWarnings("unchecked") NumericJsonSchemaObject lte(Number max) { Assert.notNull(max, "Max must not be null!"); Bound lower = this.range != null ? this.range.getLowerBound() : Bound.unbounded(); return within(Range.of(lower, createBound(max, true))); }
/** * Set {@literal minimum} to given {@code min} value and {@literal exclusiveMinimum} to {@literal true}. * * @param min must not be {@literal null}. * @return new instance of {@link NumericJsonSchemaObject}. */ @SuppressWarnings("unchecked") public NumericJsonSchemaObject gt(Number min) { Assert.notNull(min, "Min must not be null!"); Bound upper = this.range != null ? this.range.getUpperBound() : Bound.unbounded(); return within(Range.of(createBound(min, false), upper)); }
/** * Define the valid length range ({@literal maxLength}) for a valid field. * * @param length * @return new instance of {@link StringJsonSchemaObject}. */ public StringJsonSchemaObject maxLength(int length) { Bound<Integer> lower = this.length != null ? this.length.getLowerBound() : Bound.unbounded(); return length(Range.of(lower, Bound.inclusive(length))); }
/** * Define the {@literal minProperties}. * * @param count the allowed minimal number of properties. * @return new instance of {@link ObjectJsonSchemaObject}. */ public ObjectJsonSchemaObject minProperties(int count) { Bound<Integer> upper = this.propertiesCount != null ? this.propertiesCount.getUpperBound() : Bound.unbounded(); return propertiesCount(Range.of(Bound.inclusive(count), upper)); }
/** * Set {@literal maximum} to given {@code max} value and {@literal exclusiveMaximum} to {@literal false}. * * @param max must not be {@literal null}. * @return new instance of {@link NumericJsonSchemaObject}. */ @SuppressWarnings("unchecked") NumericJsonSchemaObject lte(Number max) { Assert.notNull(max, "Max must not be null!"); Bound lower = this.range != null ? this.range.getLowerBound() : Bound.unbounded(); return within(Range.of(lower, createBound(max, true))); }
/** * Set {@literal minimum} to given {@code min} value and {@literal exclusiveMinimum} to {@literal false}. * * @param min must not be {@literal null}. * @return new instance of {@link NumericJsonSchemaObject}. */ @SuppressWarnings("unchecked") public NumericJsonSchemaObject gte(Number min) { Assert.notNull(min, "Min must not be null!"); Bound upper = this.range != null ? this.range.getUpperBound() : Bound.unbounded(); return within(Range.of(createBound(min, true), upper)); }
/** * Set {@literal minimum} to given {@code min} value and {@literal exclusiveMinimum} to {@literal true}. * * @param min must not be {@literal null}. * @return new instance of {@link NumericJsonSchemaObject}. */ @SuppressWarnings("unchecked") public NumericJsonSchemaObject gt(Number min) { Assert.notNull(min, "Min must not be null!"); Bound upper = this.range != null ? this.range.getUpperBound() : Bound.unbounded(); return within(Range.of(createBound(min, false), upper)); }
/** * Define the {@literal maxProperties}. * * @param count the allowed maximum number of properties. * @return new instance of {@link ObjectJsonSchemaObject}. */ public ObjectJsonSchemaObject maxProperties(int count) { Bound<Integer> lower = this.propertiesCount != null ? this.propertiesCount.getLowerBound() : Bound.unbounded(); return propertiesCount(Range.of(lower, Bound.inclusive(count))); }
/** * Define the valid length range ({@literal minLength}) for a valid field. * * @param length * @return new instance of {@link StringJsonSchemaObject}. */ public StringJsonSchemaObject minLength(int length) { Bound<Integer> upper = this.length != null ? this.length.getUpperBound() : Bound.unbounded(); return length(Range.of(Bound.inclusive(length), upper)); }
/** * Set {@literal maximum} to given {@code max} value and {@literal exclusiveMaximum} to {@literal true}. * * @param max must not be {@literal null}. * @return new instance of {@link NumericJsonSchemaObject}. */ @SuppressWarnings("unchecked") public NumericJsonSchemaObject lt(Number max) { Assert.notNull(max, "Max must not be null!"); Bound lower = this.range != null ? this.range.getLowerBound() : Bound.unbounded(); return within(Range.of(lower, createBound(max, false))); }
/** * Define the {@literal maxItems}. * * @param count the allowed minimal number of array items. * @return new instance of {@link ArrayJsonSchemaObject}. */ public ArrayJsonSchemaObject minItems(int count) { Bound<Integer> upper = this.range != null ? this.range.getUpperBound() : Bound.unbounded(); return range(Range.of(Bound.inclusive(count), upper)); }
/** * Define the {@literal maxItems}. * * @param count the allowed maximal number of array items. * @return new instance of {@link ArrayJsonSchemaObject}. */ public ArrayJsonSchemaObject maxItems(int count) { Bound<Integer> lower = this.range != null ? this.range.getLowerBound() : Bound.unbounded(); return range(Range.of(lower, Bound.inclusive(count))); }
/** * Set {@literal minimum} to given {@code min} value and {@literal exclusiveMinimum} to {@literal false}. * * @param min must not be {@literal null}. * @return new instance of {@link NumericJsonSchemaObject}. */ @SuppressWarnings("unchecked") public NumericJsonSchemaObject gte(Number min) { Assert.notNull(min, "Min must not be null!"); Bound upper = this.range != null ? this.range.getUpperBound() : Bound.unbounded(); return within(Range.of(createBound(min, true), upper)); }
/** * Define the {@literal maxProperties}. * * @param count the allowed maximum number of properties. * @return new instance of {@link ObjectJsonSchemaObject}. */ public ObjectJsonSchemaObject maxProperties(int count) { Bound<Integer> lower = this.propertiesCount != null ? this.propertiesCount.getLowerBound() : Bound.unbounded(); return propertiesCount(Range.of(lower, Bound.inclusive(count))); }
public Range<Distance> getDistanceRange() { MongoParameters mongoParameters = method.getParameters(); int rangeIndex = mongoParameters.getRangeIndex(); if (rangeIndex != -1) { return getValue(rangeIndex); } int maxDistanceIndex = mongoParameters.getMaxDistanceIndex(); Bound<Distance> maxDistance = maxDistanceIndex == -1 ? Bound.unbounded() : Bound.inclusive((Distance) getValue(maxDistanceIndex)); return Range.of(Bound.unbounded(), maxDistance); }
/** * Define the {@literal maxItems}. * * @param count the allowed minimal number of array items. * @return new instance of {@link ArrayJsonSchemaObject}. */ public ArrayJsonSchemaObject minItems(int count) { Bound<Integer> upper = this.range != null ? this.range.getUpperBound() : Bound.unbounded(); return range(Range.of(Bound.inclusive(count), upper)); }
/** * Define the valid length range ({@literal maxLength}) for a valid field. * * @param length * @return new instance of {@link StringJsonSchemaObject}. */ public StringJsonSchemaObject maxLength(int length) { Bound<Integer> lower = this.length != null ? this.length.getLowerBound() : Bound.unbounded(); return length(Range.of(lower, Bound.inclusive(length))); }
/** * Define the valid length range ({@literal minLength}) for a valid field. * * @param length * @return new instance of {@link StringJsonSchemaObject}. */ public StringJsonSchemaObject minLength(int length) { Bound<Integer> upper = this.length != null ? this.length.getUpperBound() : Bound.unbounded(); return length(Range.of(Bound.inclusive(length), upper)); }
/** * Define the {@literal minProperties}. * * @param count the allowed minimal number of properties. * @return new instance of {@link ObjectJsonSchemaObject}. */ public ObjectJsonSchemaObject minProperties(int count) { Bound<Integer> upper = this.propertiesCount != null ? this.propertiesCount.getUpperBound() : Bound.unbounded(); return propertiesCount(Range.of(Bound.inclusive(count), upper)); }