ValidationRuleBuilder
A builder class for creating sets of validation rules using a DSL approach.
This builder provides a convenient way to compose multiple validation rules together using a fluent API. It's typically used within validation rule DSL blocks to build complex validation logic from simpler rule components.
Note: Instead of manually creating validation rules with lambda functions, it's recommended to use the type-specific rule extensions available in the soil.form.rule
package, which provide convenient DSL methods for common validation scenarios.
Usage:
val stringRules = rules<String> {
notBlank { "Value is required" }
minLength(3) { "Must be at least 3 characters" }
maxLength(100) { "Must be at most 100 characters" }
}
Parameters
The type of the value to be validated.
Functions
Builds and returns the final set of validation rules.
Creates a validation rule chain for applying rules to each element of the array.
Creates a validation rule chain for applying rules to each element of the collection.
Adds a validation rule to the set of rules being built.
Adds multiple validation rules to the set of rules being built.
Validates that the boolean value is false
.
Validates that the boolean value is false
.
Validates that the boolean value is true
.
Validates that the string matches the pattern.
Validates that the string value is not blank.
Validates that the array is not empty.
Validates that the string value is not empty.
Validates that the collection is not empty.
Validates that the double value is not NaN
.
Validates that the float value is not NaN
.
Validates that the optional value is not null
.
Validates that the string matches the pattern.
Validates that the boolean value is true
.