T
- type of valuepublic final class Match<T>
extends java.lang.Object
Modifier and Type | Field and Description |
---|---|
static Match |
ANY |
static Match |
NOT_NULL |
static Match |
NULL |
Modifier and Type | Method and Description |
---|---|
static <T> Match<T> |
any()
Returns a Match that matches any value including null.
|
boolean |
equals(java.lang.Object other) |
int |
hashCode() |
static <T> Match<T> |
ifNotNull()
Returns a Match that matches all non-null values.
|
static <T> Match<T> |
ifNotValue(T value)
Returns a Match that matches any value except the specified value.
|
static <T> Match<T> |
ifNull()
Returns a Match that matches null values.
|
static <T> Match<T> |
ifValue(T value)
Returns a Match that only matches the specified value.
|
<V> Match<V> |
map(java.util.function.Function<T,V> mapper)
Maps this instance to a Match of another type.
|
boolean |
matches(T other)
Checks if this instance matches specified value.
|
java.lang.String |
toString() |
public static final Match ANY
public static final Match NULL
public static final Match NOT_NULL
public static <T> Match<T> any()
T
- match typepublic static <T> Match<T> ifNull()
T
- match typepublic static <T> Match<T> ifNotNull()
T
- match typepublic static <T> Match<T> ifValue(T value)
T
- match typevalue
- value to matchpublic static <T> Match<T> ifNotValue(T value)
T
- match typevalue
- value to not matchpublic <V> Match<V> map(java.util.function.Function<T,V> mapper)
V
- new match typemapper
- transformation functionpublic boolean matches(T other)
other
- other valuepublic int hashCode()
hashCode
in class java.lang.Object
public boolean equals(java.lang.Object other)
equals
in class java.lang.Object
public java.lang.String toString()
toString
in class java.lang.Object