Checkpoint |
Child of DefaultRule which accepts list of DefaultRule. When Checkpoint.canPass is invoked, function will go through all of the passed rules and invoke DefaultRule.canPass of each rule until first item that cannot pass. Create instance of class using Checkpoint.Builder or checkpoint dsl. class Checkpoint<INPUT> : DefaultRule<INPUT> |
DefaultRule |
Child of Rule with Boolean output. abstract class DefaultRule<INPUT> : Rule<INPUT, Boolean> |
DefaultRuleBuilder |
Builder for creating instance of DefaultRule without extending it. class DefaultRuleBuilder<INPUT> |
Rule |
Rules are main part of checkpoint. Rule.canPass function can be invoked directly or used by child classes. When new rule is needed, this class can be extended with the desired input and output type. abstract class Rule<INPUT, OUTPUT> |
CheckpointDslMarker |
annotation class CheckpointDslMarker |
addRule |
Executes the given builder block and adds created rule to Checkpoint.Builder. fun <T> Builder<T>.addRule(init: DefaultRuleBuilder<T>.() -> Unit): Unit |
checkpoint |
Executes the given builder block. fun <T> checkpoint(init: Builder<T>.() -> Unit): Checkpoint<T> |
newRule |
Executes the given builder block and returns new instance of DefaultRule. fun <T> newRule(init: DefaultRuleBuilder<T>.() -> Unit): DefaultRule<T> |
whenInvalid |
fun <T> DefaultRuleBuilder<T>.whenInvalid(block: (input: T) -> Unit): DefaultRuleBuilder<T> |