withCondition

Adds a conditional check to this ValidatedCondition. Apply conditional checks on top of the stored value by calling get. Get the base value with getUnconditional.

Return

this condition

Author

fzzyhmstrs

Since

0.5.4

Parameters

condition

Condition a condition to check before passing the stored value


open fun withCondition(condition: Supplier<Boolean>, failMessage: Text): ValidatedCondition<T>

Adds a conditional check to this ValidatedCondition. Apply conditional checks on top of the stored value by calling get. Get the base value with getUnconditional.

Note: a ValidatedField is a supplier. If you want a custom failMessage, this is a valid overload of withCondition(ValidatedField<Boolean>)

Return

this condition

Author

fzzyhmstrs

Since

0.5.4

Parameters

condition

Supplier a supplier of booleans for the condition to check against

failMessage

Text a message to provide to a tooltip if a condition isn't met


Adds a conditional check to this ValidatedCondition using the provided validated field as a supplier. Apply conditional checks on top of the stored value by calling get. Get the base value with getUnconditional.

Return

this condition

Author

fzzyhmstrs

Since

0.5.4

Parameters

condition

ValidatedField a condition to check before passing the stored value

Throws

if this field is passed into itself


open fun withCondition(scope: String, failMessage: Text): ValidatedCondition<T>

Adds a conditional check to this ValidatedCondition using the provided scope against a boolean provider. Apply conditional checks on top of the stored value by calling get. Get the base value with getUnconditional. The provided scope must point to a valid boolean config scope otherwise the condition will never pass.

Return

this condition

Author

fzzyhmstrs

Since

0.5.4

Parameters

scope

String - a config scope pointing to a boolean or validated boolean.

failMessage

Text a message to provide to a tooltip if a condition isn't met