Class ConstraintUtils
java.lang.Object
cz.masci.springfx.mvci.util.constraint.ConstraintUtils
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionstatic io.github.palexdev.materialfx.validation.ConstraintReturns a constraint that validates whether the given integer property is within the specified range.static io.github.palexdev.materialfx.validation.ConstraintisNotEmpty(javafx.beans.property.StringProperty stringProperty, String message) Returns a constraint that validates whether the given string property is not empty.static <T> io.github.palexdev.materialfx.validation.ConstraintisNotEmptyWhenPropertyIsNotEmpty(javafx.beans.property.StringProperty stringProperty, javafx.beans.property.Property<T> nullableProperty, String message) Returns a constraint that validates whether the given string property is not empty or the nullable property is empty.static io.github.palexdev.materialfx.validation.ConstraintReturns a constraint that validates whether the given string property contains only a number.static io.github.palexdev.materialfx.validation.ConstraintisNumberOrEmpty(javafx.beans.property.StringProperty stringProperty, String message) Returns a constraint that validates whether the given string property contains a number or is empty.static <T> io.github.palexdev.materialfx.validation.ConstraintisNumberOrEmptyWhenPropertyIsNotEmpty(javafx.beans.property.StringProperty stringProperty, javafx.beans.property.Property<T> nullableProperty, String message) Returns a constraint that validates whether the given string property contains only a number or the nullable property is empty.static <T> io.github.palexdev.materialfx.validation.ConstraintisNumberWhenPropertyIsNotEmpty(javafx.beans.property.StringProperty stringProperty, javafx.beans.property.Property<T> nullableProperty, String message) Returns a constraint that validates whether the given string property contains only a number or the nullable property is empty.static <T,U extends io.github.palexdev.materialfx.validation.Validated>
io.github.palexdev.materialfx.validation.ConstraintisValid(String message, javafx.beans.value.ObservableValue<T> parent, Function<T, javafx.beans.value.ObservableValue<U>> childMap) Returns a constraint that validates whether the child property is valid when the parent is set.
-
Constructor Details
-
ConstraintUtils
public ConstraintUtils()
-
-
Method Details
-
isNotEmpty
public static io.github.palexdev.materialfx.validation.Constraint isNotEmpty(javafx.beans.property.StringProperty stringProperty, String message) Returns a constraint that validates whether the given string property is not empty.- Parameters:
stringProperty- the string property to validatemessage- the field name used in error message for the constraint- Returns:
- a constraint that validates whether the given string property is not empty
-
isInRange
public static io.github.palexdev.materialfx.validation.Constraint isInRange(javafx.beans.property.IntegerProperty integerProperty, String message, int min, int max) Returns a constraint that validates whether the given integer property is within the specified range.- Parameters:
integerProperty- the integer property to validatemessage- the field name used in the error message for the constraintmin- the minimum value of the range (inclusive)max- the maximum value of the range (inclusive)- Returns:
- a constraint that validates whether the given integer property is within the specified range
-
isNumber
public static io.github.palexdev.materialfx.validation.Constraint isNumber(javafx.beans.property.StringProperty stringProperty, String message) Returns a constraint that validates whether the given string property contains only a number.- Parameters:
stringProperty- the string property to validatemessage- the field name used in the error message for the constraint- Returns:
- a constraint that validates whether the given string property contains only a number
-
isNumberOrEmpty
public static io.github.palexdev.materialfx.validation.Constraint isNumberOrEmpty(javafx.beans.property.StringProperty stringProperty, String message) Returns a constraint that validates whether the given string property contains a number or is empty.- Parameters:
stringProperty- the string property to validatemessage- the field name used in the error message for the constraint- Returns:
- a constraint that validates whether the given string property contains only a number
-
isNotEmptyWhenPropertyIsNotEmpty
public static <T> io.github.palexdev.materialfx.validation.Constraint isNotEmptyWhenPropertyIsNotEmpty(javafx.beans.property.StringProperty stringProperty, javafx.beans.property.Property<T> nullableProperty, String message) Returns a constraint that validates whether the given string property is not empty or the nullable property is empty.- Type Parameters:
T- Type of the nullable property- Parameters:
stringProperty- the string property to validatenullableProperty- the nullable propertymessage- the field name used in error message for the constraint- Returns:
- a constraint that validates whether the given string property is not empty
-
isNumberWhenPropertyIsNotEmpty
public static <T> io.github.palexdev.materialfx.validation.Constraint isNumberWhenPropertyIsNotEmpty(javafx.beans.property.StringProperty stringProperty, javafx.beans.property.Property<T> nullableProperty, String message) Returns a constraint that validates whether the given string property contains only a number or the nullable property is empty.- Type Parameters:
T- Type of the nullable property- Parameters:
stringProperty- the string property to validatenullableProperty- the nullable propertymessage- the field name used in the error message for the constraint- Returns:
- a constraint that validates whether the given string property contains only a number
-
isNumberOrEmptyWhenPropertyIsNotEmpty
public static <T> io.github.palexdev.materialfx.validation.Constraint isNumberOrEmptyWhenPropertyIsNotEmpty(javafx.beans.property.StringProperty stringProperty, javafx.beans.property.Property<T> nullableProperty, String message) Returns a constraint that validates whether the given string property contains only a number or the nullable property is empty.- Type Parameters:
T- Type of the nullable property- Parameters:
stringProperty- the string property to validatenullableProperty- the nullable propertymessage- the field name used in the error message for the constraint- Returns:
- a constraint that validates whether the given string property contains only a number
-
isValid
public static <T,U extends io.github.palexdev.materialfx.validation.Validated> io.github.palexdev.materialfx.validation.Constraint isValid(String message, javafx.beans.value.ObservableValue<T> parent, Function<T, javafx.beans.value.ObservableValue<U>> childMap) Returns a constraint that validates whether the child property is valid when the parent is set.- Type Parameters:
T- Type of the parent observable valueU- Type of the child observable value- Parameters:
message- error message for the constraintparent- the parent object from which the child property is takenchildMap- the child object mapper- Returns:
- a constraint that validates whether the child property satisfies to the test
-