public abstract class AbstractCheckDsl<L,D> extends Object implements CheckDsl<L,D>
| Modifier | Constructor and Description |
|---|---|
protected |
AbstractCheckDsl(Function<Check<D>,L> factory) |
protected |
AbstractCheckDsl(Check<? super D> check,
Function<Check<D>,L> factory) |
| Modifier and Type | Method and Description |
|---|---|
Result |
evaluate(D data,
ResultFactory factory)
Abstract method to delegate implementation of specific check logic to subclasses.
|
L |
or()
Allow chaining of checks using logical or.
|
String |
toString() |
L |
with(Check<? super D> check)
Add check of the root object to the
|
<V> TransformationBuilder<V,L> |
withField(String name,
Transformation<? super D,V> transformation)
Add a check of a transformed value, e.g. field access.
|
<V> TransformationBuilder<V,L> |
withField(Transformation<? super D,V> transformation)
Add a check of a transformed value, e.g. field access.
|
public L with(Check<? super D> check)
CheckDslpublic <V> TransformationBuilder<V,L> withField(String name, Transformation<? super D,V> transformation)
CheckDslwithField in interface CheckDsl<L,D>V - Type of the transformed value.name - Name of the transformation / fieldtransformation - Transformation function to apply in order to check the result.public <V> TransformationBuilder<V,L> withField(Transformation<? super D,V> transformation)
CheckDslpublic L or()
CheckDslcheck.withField(MyClass::getFirstName).equalTo("John").withField(MyClass::getLastName).equalTo("Doe")
.or()
.withField(MyClass::getFirstName).equalTo("Jane").withField(MyClass::getLastName).equalTo("Dee")
evaluates as:
(firstName == "John" and lastName == "Doe") or (firstName == "Jane" and lastName == "Dee")public Result evaluate(D data, ResultFactory factory)
CheckCopyright © 2021. All rights reserved.