public class Matching
extends java.lang.Object
| Constructor and Description |
|---|
Matching() |
| Modifier and Type | Method and Description |
|---|---|
static <T,X> MatchingInstance<T,X> |
of(Cases<T,X,? extends java.util.function.Function<T,X>> cases)
Create a Pattern Matcher Builder from supplied Cases
|
static <X> ElementCase<X> |
when()
Create a builder for Matching against a provided Object as is (i.e.
|
static <V,X> CaseBuilder.InMatchOfBuilder<V,X> |
whenAllMatch(org.hamcrest.Matcher<V>... matchers)
Build a Case which is triggered when all of the supplied Hamcrest Matchers holds
|
static <V,X> CaseBuilder.InMatchOfBuilder<V,X> |
whenAnyMatch(org.hamcrest.Matcher<V>... matchers)
Build a Case which is triggered when any of the supplied Hamcrest Matchers holds
|
static <V,X> CaseBuilder.InMatchOfBuilder<V,X> |
whenIsMatch(org.hamcrest.Matcher<V> match)
Build a Case which is triggered when the supplied Hamcrest Matcher holds
|
static <V> CaseBuilder.InCaseOfBuilder<V> |
whenIsTrue(java.util.function.Predicate<V> match)
Build a Case which is triggered when the supplied Predicate holds
|
static <T,R> MatchingInstance<T,R> |
whenIsType(TypedFunction<T,R> a)
Create a completed Case which is triggered when matching input is of the same type (T) as the input parameter to ActionWithReturn.
|
static <V,X> Step<V,X> |
whenIsValue(V value)
Build a Case which is triggered when the user input matches the supplied Value (via Objects.equals)
|
static <V,X> CaseBuilder.InMatchOfBuilder<V,X> |
whenNoneMatch(org.hamcrest.Matcher<V>... matchers)
Build a Case which is triggered when none of the supplied Hamcrest Matchers holds
|
public static final <T,X> MatchingInstance<T,X> of(Cases<T,X,? extends java.util.function.Function<T,X>> cases)
cases - to match onpublic static final <X> ElementCase<X> when()
public static final <V,X> Step<V,X> whenIsValue(V value)
value - will be compared to input provided in match methodpublic static final <T,R> MatchingInstance<T,R> whenIsType(TypedFunction<T,R> a)
a - Action for the new Case, Predicate for the Case will be created from the input type to the Action.public static final <V> CaseBuilder.InCaseOfBuilder<V> whenIsTrue(java.util.function.Predicate<V> match)
match - Predicate which will trigger this casepublic static final <V,X> CaseBuilder.InMatchOfBuilder<V,X> whenIsMatch(org.hamcrest.Matcher<V> match)
match - Hamcrest Matcher that will trigger this case@SafeVarargs public static final <V,X> CaseBuilder.InMatchOfBuilder<V,X> whenAllMatch(org.hamcrest.Matcher<V>... matchers)
matchers - Hamcrest Matchers that will trigger this case@SafeVarargs public static final <V,X> CaseBuilder.InMatchOfBuilder<V,X> whenAnyMatch(org.hamcrest.Matcher<V>... matchers)
matchers - Hamcrest Matchers that will trigger this case@SafeVarargs public static final <V,X> CaseBuilder.InMatchOfBuilder<V,X> whenNoneMatch(org.hamcrest.Matcher<V>... matchers)
matchers - Hamcrest Matchers that will trigger this case