public class Selector<T> extends Object
select
expression. The keys of a mapping are SelectorKey
s and the values can be of an arbitrary type.Constructor and Description |
---|
Selector(com.google.common.collect.ImmutableMap<SelectorKey,T> conditions,
com.google.common.collect.ImmutableSet<SelectorKey> nullConditions,
String noMatchMessage)
Creates a new Selector with a custom error message for a situation when no conditions match.
|
Modifier and Type | Method and Description |
---|---|
boolean |
equals(Object o) |
com.google.common.collect.ImmutableMap<SelectorKey,T> |
getConditions() |
T |
getDefaultConditionValue()
Returns the default value - value to use when none of the conditions match.
|
String |
getNoMatchMessage()
Returns a custom message that needs to be shown to a user when no condition matches.
|
com.google.common.collect.ImmutableSet<SelectorKey> |
getNullConditions() |
boolean |
hasDefaultCondition()
Returns whether or not this selector has a default condition.
|
int |
hashCode() |
<U,E extends Exception> |
mapValuesThrowing(ThrowingFunction<T,U,E> function)
Transform all items with given function.
|
static <T> Selector<T> |
onlyDefault(T element) |
String |
toString() |
public Selector(com.google.common.collect.ImmutableMap<SelectorKey,T> conditions, com.google.common.collect.ImmutableSet<SelectorKey> nullConditions, String noMatchMessage)
public static <T> Selector<T> onlyDefault(T element)
public com.google.common.collect.ImmutableMap<SelectorKey,T> getConditions()
public com.google.common.collect.ImmutableSet<SelectorKey> getNullConditions()
@Nullable public T getDefaultConditionValue()
null
if it wasn't provided.public boolean hasDefaultCondition()
public String getNoMatchMessage()