Package dk.mada.jaxrs.model
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
Returns an empty validation.- Returns:
- an empty validation
-
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
Returns the optional minimal items.- Returns:
- the optional minimal items
-
maxItems
Returns the optional maximal items.- Returns:
- the optional maximal items
-
minLength
Returns the optional minimal length.- Returns:
- the optional minimal length
-
maxLength
Returns the optional maximal length.- Returns:
- the optional maximal length
-
minimum
Returns the optional minimum.- Returns:
- the optional minimum
-
maximum
Returns the optional maximum.- Returns:
- the optional maximum
-
pattern
Returns the optional pattern.- Returns:
- the optional pattern
-
toString
Returns a string representation of this record class. The representation contains the name of the class, followed by the name and value of each of the record components. -
hashCode
public final int hashCode()Returns a hash code value for this object. The value is derived from the hash code of each of the record components. -
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 '=='. -
required
public boolean required()Returns the value of therequiredrecord component.- Returns:
- the value of the
requiredrecord component
-
nullable
public boolean nullable()Returns the value of thenullablerecord component.- Returns:
- the value of the
nullablerecord component
-
readonly
Returns the value of thereadonlyrecord component.- Returns:
- the value of the
readonlyrecord component
-
_minItems
Returns the value of the_minItemsrecord component.- Returns:
- the value of the
_minItemsrecord component
-
_maxItems
Returns the value of the_maxItemsrecord component.- Returns:
- the value of the
_maxItemsrecord component
-
_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
Returns the value of the_minimumrecord component.- Returns:
- the value of the
_minimumrecord component
-
_exclusiveMinimum
Returns the value of the_exclusiveMinimumrecord component.- Returns:
- the value of the
_exclusiveMinimumrecord component
-
_maximum
Returns the value of the_maximumrecord component.- Returns:
- the value of the
_maximumrecord component
-
_exclusiveMaximum
Returns the value of the_exclusiveMaximumrecord component.- Returns:
- the value of the
_exclusiveMaximumrecord component
-
_pattern
Returns the value of the_patternrecord component.- Returns:
- the value of the
_patternrecord component
-