java.lang.Object
io.github.palexdev.materialfx.validation.Constraint
Bean used by
MFXValidator to define a condition to be met in order
for the validator' state to be valid.
This bean allows to specify the Severity of the condition, the message
to show when invalid, and of course the BooleanExpression that is the condition itself.
It also allows to specify how this constraint should chained with others by setting its ChainMode,
setChainMode(ChainMode).
Constraint.Builder, or the parameterized constructors.-
Nested Class Summary
Nested Classes -
Constructor Summary
ConstructorsModifierConstructorDescriptionprotectedConstraint(Severity severity, String message, BooleanExpression condition) Constraint(String message, BooleanExpression condition) -
Method Summary
Modifier and TypeMethodDescriptionbooleanisValid()static Constraintof(Severity severity, String message, BooleanExpression condition) static Constraintof(String message, BooleanExpression condition) setChainMode(ChainMode chainMode) Sets the mode defining how this constraint will be chained to other constraints.protected voidsetCondition(BooleanExpression condition) Sets theBooleanExpressionused to define the condition.protected voidsetMessage(String message) Sets the message to show in case the condition is not valid.protected voidsetSeverity(Severity severity) Sets the severity of the condition.
-
Constructor Details
-
Constraint
protected Constraint() -
Constraint
-
Constraint
-
-
Method Details
-
of
- Returns:
- a new
Constraintwith ERROR severity and the given message and condition
-
of
- Returns:
- a new
Constraintwith the given severity, message and condition
-
isValid
public boolean isValid()- Returns:
- whether the specified condition is valid
-
getSeverity
- Returns:
- the severity of the condition
-
setSeverity
Sets the severity of the condition. -
getMessage
- Returns:
- the message to show in case the condition is not valid
-
setMessage
Sets the message to show in case the condition is not valid. -
getCondition
- Returns:
- the
BooleanExpressionused to define the condition
-
setCondition
Sets theBooleanExpressionused to define the condition. -
getChainMode
- Returns:
- the mode defining how this constraint will be chained to other constraints
-
setChainMode
Sets the mode defining how this constraint will be chained to other constraints.
-