Interface Validator

All Known Implementing Classes:
CacheExistsValidator, DefaultValue, GreaterThanZero, Max, MaxLength, Min, MinLength, NotImplemented, Required, Requires, Type, TypeOneOf, ValueOneOf, ValueRequires, ValueRequiresOneOf
Functional Interface:
This is a functional interface and can therefore be used as the assignment target for a lambda expression or method reference.

@FunctionalInterface public interface Validator
I help validate records
  • Field Details

    • REQUIRED

      static final Validator REQUIRED
    • NON_EMPTY

      static final Validator NON_EMPTY
    • TYPE

      static final Validator TYPE
    • DEFAULT_VALUE

      static final Validator DEFAULT_VALUE
    • NOT_IMPLEMENTED

      static final Validator NOT_IMPLEMENTED
  • Method Details

    • validate

      void validate(IBoxContext context, Key caller, Validatable record, IStruct records)
      Validate a record instance.
      Parameters:
      context - The current Box context
      caller - The component being validated
      record - The specific record being validated
      records - All the records being validated
    • min

      static Validator min(Number min)
      Builder method to create a Min validator
      Parameters:
      min - The minimum value
      Returns:
      The Min validator
    • max

      static Validator max(Number max)
      Builder method to create a Max validator
      Parameters:
      max - The maximum value
      Returns:
      The Max validator
    • maxLength

      static Validator maxLength(Number maxLength)
      Builder method to create a MaxLength validator
      Parameters:
      maxLength - The maximum length
      Returns:
      The MaxLength validator
    • minLength

      static Validator minLength(Number minLength)
      Builder method to create a MinLength validator
      Parameters:
      minLength - The minimum length
      Returns:
      The MinLength validator
    • requires

      static Validator requires(Key... recordNames)
      Builder method to create a Requires validator
      Parameters:
      recordNames - The names of the records that are required if this record is present
      Returns:
      The Requires validator
    • valueRequires

      static Validator valueRequires(String value, Key... recordNames)
      Builder method to create a Requires validator
      Parameters:
      recordNames - The names of the records that are required if this record is present
      Returns:
      The Requires validator
    • valueRequiresOneOf

      static Validator valueRequiresOneOf(String value, Key... recordNames)
      Builder method to create a Requires validator
      Parameters:
      recordNames - The names of the records that are required if this record is present
      Returns:
      The Requires validator
    • valueOneOf

      static Validator valueOneOf(String... validValues)
      Builder method to create a ValueOneOf validator
      Parameters:
      validValues - The valid values
      Returns:
      The ValueOneOf validator
    • typeOneOf

      static Validator typeOneOf(String... validTypes)