Record Class Validation
java.lang.Object
java.lang.Record
dk.mada.jaxrs.model.Validation
- Record Components:
required- validation flag requirednullable- validation flag nullablereadonly- validation flag read-only_minItems- optional validation minimal items_maxItems- optional validation maxmimal items_minLength- optional validation minimal length_maxLength- optional validation maxmimal length_minimum- optional validation minimum_exclusiveMinimum- optional validation exclusive-minimum_maximum- optional validation maximum_exclusiveMaximum- optional validation exclusive-maximum_pattern- optional validation pattern
public record Validation(boolean required, boolean nullable, @Nullable Boolean readonly, @Nullable Integer _minItems, @Nullable Integer _maxItems, @Nullable Integer _minLength, @Nullable Integer _maxLength, @Nullable BigDecimal _minimum, @Nullable Boolean _exclusiveMinimum, @Nullable BigDecimal _maximum, @Nullable Boolean _exclusiveMaximum, @Nullable String _pattern)
extends Record
Models the validation requirements for a type or its reference.
-
Constructor Summary
ConstructorsConstructorDescriptionValidation(boolean required, boolean nullable, @Nullable Boolean readonly, @Nullable Integer _minItems, @Nullable Integer _maxItems, @Nullable Integer _minLength, @Nullable Integer _maxLength, @Nullable BigDecimal _minimum, @Nullable Boolean _exclusiveMinimum, @Nullable BigDecimal _maximum, @Nullable Boolean _exclusiveMaximum, @Nullable String _pattern) Creates an instance of aValidationrecord class. -
Method Summary
Modifier and TypeMethodDescription@Nullable BooleanReturns the value of the_exclusiveMaximumrecord component.@Nullable BooleanReturns the value of the_exclusiveMinimumrecord component.@Nullable BigDecimal_maximum()Returns the value of the_maximumrecord component.@Nullable IntegerReturns the value of the_maxItemsrecord component.@Nullable IntegerReturns the value of the_maxLengthrecord component.@Nullable BigDecimal_minimum()Returns the value of the_minimumrecord component.@Nullable IntegerReturns the value of the_minItemsrecord component.@Nullable IntegerReturns the value of the_minLengthrecord component.@Nullable String_pattern()Returns the value of the_patternrecord component.static Validationempty()Returns an empty validation.final booleanIndicates whether some other object is "equal to" this one.final inthashCode()Returns a hash code value for this object.booleanReturns true if this is a simple empty/no validation.booleanReturns true if read-only is set.maximum()Returns the optional maximum.maxItems()Returns the optional maximal items.Returns the optional maximal length.minimum()Returns the optional minimum.minItems()Returns the optional minimal items.Returns the optional minimal length.booleannullable()Returns the value of thenullablerecord component.pattern()Returns the optional pattern.@Nullable Booleanreadonly()Returns the value of thereadonlyrecord component.booleanrequired()Returns the value of therequiredrecord component.final StringtoString()Returns a string representation of this record class.static ValidationReturns a validation with required set.
-
Constructor Details
-
Validation
public Validation(boolean required, boolean nullable, @Nullable Boolean readonly, @Nullable Integer _minItems, @Nullable Integer _maxItems, @Nullable Integer _minLength, @Nullable Integer _maxLength, @Nullable BigDecimal _minimum, @Nullable Boolean _exclusiveMinimum, @Nullable BigDecimal _maximum, @Nullable Boolean _exclusiveMaximum, @Nullable String _pattern) Creates an instance of aValidationrecord class.- Parameters:
required- the value for therequiredrecord componentnullable- the value for thenullablerecord componentreadonly- the value for thereadonlyrecord component_minItems- the value for the_minItemsrecord component_maxItems- the value for the_maxItemsrecord component_minLength- the value for the_minLengthrecord component_maxLength- the value for the_maxLengthrecord component_minimum- the value for the_minimumrecord component_exclusiveMinimum- the value for the_exclusiveMinimumrecord component_maximum- the value for the_maximumrecord component_exclusiveMaximum- the value for the_exclusiveMaximumrecord component_pattern- the value for the_patternrecord component
-
-
Method Details
-
empty
-
validationRequired
Returns a validation with required set.- Returns:
- a validation with required set
-
isEmptyValidation
public boolean isEmptyValidation()Returns true if this is a simple empty/no validation.- Returns:
- true if this is a simple empty/no validation
-
isReadOnly
public boolean isReadOnly()Returns true if read-only is set.- Returns:
- true if read-only is set
-
minItems
-
maxItems
-
minLength
-
maxLength
-
minimum
-
maximum
-
pattern
-
toString
-
hashCode
-
equals
Indicates whether some other object is "equal to" this one. The objects are equal if the other object is of the same class and if all the record components are equal. Reference components are compared withObjects::equals(Object,Object); primitive components are compared with thecomparemethod from their corresponding wrapper classes. -
required
-
nullable
-
readonly
-
_minItems
-
_maxItems
-
_minLength
Returns the value of the_minLengthrecord component.- Returns:
- the value of the
_minLengthrecord component
-
_maxLength
Returns the value of the_maxLengthrecord component.- Returns:
- the value of the
_maxLengthrecord component
-
_minimum
-
_exclusiveMinimum
Returns the value of the_exclusiveMinimumrecord component.- Returns:
- the value of the
_exclusiveMinimumrecord component
-
_maximum
-
_exclusiveMaximum
Returns the value of the_exclusiveMaximumrecord component.- Returns:
- the value of the
_exclusiveMaximumrecord component
-
_pattern
-