Apply custom validators
Requires: abstractions module, main module (constraints).
Validation feature allows to associate a custom user-made validator with a settings type. Validation occurs during binding and results in binding errors for incorrect settings.
Constraints
There are also built-in validation constraints you can use to create a custom validator. Just inherit your validator class from ConstraintsValidator
and override a method returning constraints to be checked:
Here's a list of all currently implemented constraint types:
NotNullConstraint
for arbitrary reference types;NotNullOrEmptyConstraint
for strings;NotNullOrWhitespaceConstraint
for strings;RangeConstraint
,LessConstraint
,LessOrEqualConstraint
,GreaterConstraint
andGreaterOrEqualConstraint
for any types that implementIComparable
;UniqueConstraint
to check that a set of field/properties only contains unique values;
Related pages
Last updated
Was this helpful?