Record Class Validation

java.lang.Object
java.lang.Record
dk.mada.jaxrs.model.Validation
Record Components:
required - validation flag required
nullable - validation flag nullable
readonly - 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 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 a Validation record class.
      Parameters:
      required - the value for the required record component
      nullable - the value for the nullable record component
      readonly - the value for the readonly 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

      public static Validation empty()
      Returns an empty validation.
      Returns:
      an empty validation
    • validationRequired

      public static 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

      public Optional<Integer> minItems()
      Returns the optional minimal items.
      Returns:
      the optional minimal items
    • maxItems

      public Optional<Integer> maxItems()
      Returns the optional maximal items.
      Returns:
      the optional maximal items
    • minLength

      public Optional<Integer> minLength()
      Returns the optional minimal length.
      Returns:
      the optional minimal length
    • maxLength

      public Optional<Integer> maxLength()
      Returns the optional maximal length.
      Returns:
      the optional maximal length
    • minimum

      public Optional<BigDecimal> minimum()
      Returns the optional minimum.
      Returns:
      the optional minimum
    • maximum

      public Optional<BigDecimal> maximum()
      Returns the optional maximum.
      Returns:
      the optional maximum
    • pattern

      public Optional<String> pattern()
      Returns the optional pattern.
      Returns:
      the optional pattern
    • toString

      public final String 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.
      Specified by:
      toString in class Record
      Returns:
      a string representation of this object
    • 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.
      Specified by:
      hashCode in class Record
      Returns:
      a hash code value for this object
    • equals

      public final boolean equals(Object o)
      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 with Objects::equals(Object,Object); primitive components are compared with '=='.
      Specified by:
      equals in class Record
      Parameters:
      o - the object with which to compare
      Returns:
      true if this object is the same as the o argument; false otherwise.
    • required

      public boolean required()
      Returns the value of the required record component.
      Returns:
      the value of the required record component
    • nullable

      public boolean nullable()
      Returns the value of the nullable record component.
      Returns:
      the value of the nullable record component
    • readonly

      public @Nullable Boolean readonly()
      Returns the value of the readonly record component.
      Returns:
      the value of the readonly record component
    • _minItems

      public @Nullable Integer _minItems()
      Returns the value of the _minItems record component.
      Returns:
      the value of the _minItems record component
    • _maxItems

      public @Nullable Integer _maxItems()
      Returns the value of the _maxItems record component.
      Returns:
      the value of the _maxItems record component
    • _minLength

      public @Nullable Integer _minLength()
      Returns the value of the _minLength record component.
      Returns:
      the value of the _minLength record component
    • _maxLength

      public @Nullable Integer _maxLength()
      Returns the value of the _maxLength record component.
      Returns:
      the value of the _maxLength record component
    • _minimum

      public @Nullable BigDecimal _minimum()
      Returns the value of the _minimum record component.
      Returns:
      the value of the _minimum record component
    • _exclusiveMinimum

      public @Nullable Boolean _exclusiveMinimum()
      Returns the value of the _exclusiveMinimum record component.
      Returns:
      the value of the _exclusiveMinimum record component
    • _maximum

      public @Nullable BigDecimal _maximum()
      Returns the value of the _maximum record component.
      Returns:
      the value of the _maximum record component
    • _exclusiveMaximum

      public @Nullable Boolean _exclusiveMaximum()
      Returns the value of the _exclusiveMaximum record component.
      Returns:
      the value of the _exclusiveMaximum record component
    • _pattern

      public @Nullable String _pattern()
      Returns the value of the _pattern record component.
      Returns:
      the value of the _pattern record component