public class RecursiveMatcher
extends java.lang.Object
| Constructor and Description |
|---|
RecursiveMatcher() |
| Modifier and Type | Method and Description |
|---|---|
static <USER_VALUE> |
when()
Create a builder for Matching on Case classes.
|
static <X,T,R> CheckTypeAndValues.AndMembersMatchBuilder<T,R> |
whenIsType(java.lang.Class<T> t,
java.util.function.Function<T,R> f) |
static <X,T,R> CheckTypeAndValues.AndMembersMatchBuilder<T,R> |
whenIsType(TypedFunction<T,R> a)
Build a Case where we will check if user input matches the Type of the input params on the ActionWithReturn instance supplied
If it does, the ActionWithReturn will be executed (applied) to get the result of the Match.
|
public static final <USER_VALUE> CheckTypeAndValues<USER_VALUE> when()
\@Value final class CaseClass implements Decomposable { int field1; String field2;}
Use with static imports from the Predicates class to get wildcards via '__' or ANY()
And to apply nested / recursive matching via Predicates.type( ).with ( )
Match disaggregated elements by type, value, JDK 8 Predicate or Hamcrest Matcherpublic static final <X,T,R> CheckTypeAndValues.AndMembersMatchBuilder<T,R> whenIsType(TypedFunction<T,R> a)
a - Action from which the Predicate (by param type) and Function will be extracted to build a Pattern Matching caseExtractors.decompose(),
Extractors.registerDecompositionFunction(java.lang.Class<T>, java.util.function.Function<T, R>)public static final <X,T,R> CheckTypeAndValues.AndMembersMatchBuilder<T,R> whenIsType(java.lang.Class<T> t, java.util.function.Function<T,R> f)