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 aValidation
record class. -
Method Summary
Modifier and TypeMethodDescription@Nullable Boolean
Returns the value of the_exclusiveMaximum
record component.@Nullable Boolean
Returns the value of the_exclusiveMinimum
record component.@Nullable BigDecimal
_maximum()
Returns the value of the_maximum
record component.@Nullable Integer
Returns the value of the_maxItems
record component.@Nullable Integer
Returns the value of the_maxLength
record component.@Nullable BigDecimal
_minimum()
Returns the value of the_minimum
record component.@Nullable Integer
Returns the value of the_minItems
record component.@Nullable Integer
Returns the value of the_minLength
record component.@Nullable String
_pattern()
Returns the value of the_pattern
record component.static Validation
empty()
Returns an empty validation.final boolean
Indicates whether some other object is "equal to" this one.final int
hashCode()
Returns a hash code value for this object.boolean
Returns true if this is a simple empty/no validation.boolean
Returns 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.boolean
nullable()
Returns the value of thenullable
record component.pattern()
Returns the optional pattern.@Nullable Boolean
readonly()
Returns the value of thereadonly
record component.boolean
required()
Returns the value of therequired
record component.final String
toString()
Returns a string representation of this record class.static Validation
Returns 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 aValidation
record class.- Parameters:
required
- the value for therequired
record componentnullable
- the value for thenullable
record componentreadonly
- the value for thereadonly
record component_minItems
- the value for the_minItems
record component_maxItems
- the value for the_maxItems
record component_minLength
- the value for the_minLength
record component_maxLength
- the value for the_maxLength
record component_minimum
- the value for the_minimum
record component_exclusiveMinimum
- the value for the_exclusiveMinimum
record component_maximum
- the value for the_maximum
record component_exclusiveMaximum
- the value for the_exclusiveMaximum
record component_pattern
- the value for the_pattern
record 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 therequired
record component.- Returns:
- the value of the
required
record component
-
nullable
public boolean nullable()Returns the value of thenullable
record component.- Returns:
- the value of the
nullable
record component
-
readonly
Returns the value of thereadonly
record component.- Returns:
- the value of the
readonly
record component
-
_minItems
Returns the value of the_minItems
record component.- Returns:
- the value of the
_minItems
record component
-
_maxItems
Returns the value of the_maxItems
record component.- Returns:
- the value of the
_maxItems
record component
-
_minLength
Returns the value of the_minLength
record component.- Returns:
- the value of the
_minLength
record component
-
_maxLength
Returns the value of the_maxLength
record component.- Returns:
- the value of the
_maxLength
record component
-
_minimum
Returns the value of the_minimum
record component.- Returns:
- the value of the
_minimum
record component
-
_exclusiveMinimum
Returns the value of the_exclusiveMinimum
record component.- Returns:
- the value of the
_exclusiveMinimum
record component
-
_maximum
Returns the value of the_maximum
record component.- Returns:
- the value of the
_maximum
record component
-
_exclusiveMaximum
Returns the value of the_exclusiveMaximum
record component.- Returns:
- the value of the
_exclusiveMaximum
record component
-
_pattern
Returns the value of the_pattern
record component.- Returns:
- the value of the
_pattern
record component
-