Package com.vaadin.signals.function
Interface CommandValidator
- All Superinterfaces:
Serializable
- Functional Interface:
- This is a functional interface and can therefore be used as the assignment target for a lambda expression or method reference.
Validates whether a signal command is allowed to be executed on a signal.
Used to enforce access control, readonly constraints, or custom business
rules.
Validators can be composed using the and(CommandValidator) method to
require multiple validation rules to pass.
-
Field Summary
FieldsModifier and TypeFieldDescriptionstatic final CommandValidatorA validator that accepts all commands without restriction.static final CommandValidatorA validator that rejects all commands, making the signal readonly. -
Method Summary
Modifier and TypeMethodDescriptiondefault CommandValidatorand(CommandValidator other) Returns a composed validator that represents a logical AND of this validator and another.booleanisValid(SignalCommand command) Tests whether the given command is valid and should be allowed to execute.
-
Field Details
-
ACCEPT_ALL
A validator that accepts all commands without restriction. -
REJECT_ALL
A validator that rejects all commands, making the signal readonly.
-
-
Method Details
-
isValid
Tests whether the given command is valid and should be allowed to execute.- Parameters:
command- the command to validate, notnull- Returns:
trueif the command is valid,falseotherwise
-
and
Returns a composed validator that represents a logical AND of this validator and another. Both validators must accept the command for the composed validator to accept it.- Parameters:
other- the validator to combine with, notnull- Returns:
- a composed validator, not
null
-