Package ortus.boxlang.runtime.validation
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.
I help validate records
-
Field Summary
Fields -
Method Summary
Modifier and TypeMethodDescriptionstatic ValidatorBuilder method to create a Max validatorstatic ValidatorBuilder method to create a MaxLength validatorstatic ValidatorBuilder method to create a Min validatorstatic ValidatorBuilder method to create a MinLength validatorstatic ValidatorBuilder method to create a Requires validatorstatic Validatorvoidvalidate(IBoxContext context, Key caller, Validatable record, IStruct records) Validate a record instance.static ValidatorvalueOneOf(String... validValues) Builder method to create a ValueOneOf validatorstatic ValidatorvalueRequires(String value, Key... recordNames) Builder method to create a Requires validatorstatic ValidatorvalueRequiresOneOf(String value, Key... recordNames) Builder method to create a Requires validator
-
Field Details
-
REQUIRED
-
NON_EMPTY
-
TYPE
-
DEFAULT_VALUE
-
NOT_IMPLEMENTED
-
-
Method Details
-
validate
Validate a record instance.- Parameters:
context- The current Box contextcaller- The component being validatedrecord- The specific record being validatedrecords- All the records being validated
-
min
Builder method to create a Min validator- Parameters:
min- The minimum value- Returns:
- The Min validator
-
max
Builder method to create a Max validator- Parameters:
max- The maximum value- Returns:
- The Max validator
-
maxLength
Builder method to create a MaxLength validator- Parameters:
maxLength- The maximum length- Returns:
- The MaxLength validator
-
minLength
Builder method to create a MinLength validator- Parameters:
minLength- The minimum length- Returns:
- The MinLength validator
-
requires
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
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
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
Builder method to create a ValueOneOf validator- Parameters:
validValues- The valid values- Returns:
- The ValueOneOf validator
-
typeOneOf
-