T - The enumpublic class EnumSelector<T extends java.lang.Enum<T>>
extends java.lang.Object
implements java.lang.Iterable<T>
| Modifier and Type | Method and Description |
|---|---|
EnumSelector<T> |
allowAll()
Make the EnumSelector allow all for the given type by default.
|
boolean |
allows(T value)
Check if the
enum value is allowed by this EnumSelector. |
boolean |
allowsAll()
Check if the EnumSelector allows all values.
|
EnumSelector<T> |
apart(java.lang.Iterable<T> values)
Specify which
enum values should have behavior opposite of the default |
EnumSelector<T> |
apart(T... values)
Specify which
enum values should have behavior opposite of the default |
EnumSelector<T> |
apart(T value)
Specify which
enum values should have behavior opposite of the default |
EnumSelector<T> |
apart(T first,
T second)
Specify which
enum values should have behavior opposite of the default |
EnumSelector<T> |
blockAll()
Make the EnumSelector block all for the given type by default.
|
boolean |
blocks(T value)
Check if the
enum value is blocked by this EnumSelector. |
boolean |
blocksAll()
Check if the EnumSelector blocks all values.
|
boolean |
equals(java.lang.Object other) |
int |
hashCode() |
java.util.Iterator<T> |
iterator()
Returns an iterator of all the allowed elements in this EnumSelector.
|
EnumSelector<T> |
lock()
Lock the EnumSelector, making it immutable.
|
boolean |
locked()
Check if the EnumSelector instance has been locked.
|
static <T extends java.lang.Enum<T>> |
of(java.lang.Class<T> enumClass)
Creates a new instance of EnumSelector for the given type.
|
java.util.stream.Stream<T> |
parallelStream()
Returns a parallel stream of all the allowed elements in this EnumSelector.
|
int |
size()
Returns the count of all the allowed elements in this EnumSelector.
|
java.util.Spliterator<T> |
spliterator()
Returns a spliterator of all the allowed elements in this EnumSelector.
|
java.util.stream.Stream<T> |
stream()
Returns a sequential stream of all the allowed elements in this EnumSelector.
|
java.util.Set<T> |
toSet()
Returns a Set instance of all the allowed elements in this EnumSelector.
|
java.lang.String |
toString() |
public static <T extends java.lang.Enum<T>> EnumSelector<T> of(java.lang.Class<T> enumClass)
T - The enum typeenumClass - The enum class for which to create an EnumSelector.public EnumSelector<T> allowAll()
Use apart(java.lang.Enum) to specify what should be blocked.
java.lang.IllegalStateException - If the EnumSelector has been locked.blockAll(),
apart(java.lang.Enum)public EnumSelector<T> blockAll()
Use apart(java.lang.Enum) to specify what should be allowed.
java.lang.IllegalStateException - If the EnumSelector has been locked.allowAll(),
apart(java.lang.Enum)public EnumSelector<T> apart(T value)
enum values should have behavior opposite of the defaultvalue - The given enum value that should have behavior opposite of the default.java.lang.IllegalStateException - If the EnumSelector has been locked.allowAll(),
blockAll()public EnumSelector<T> apart(T first, T second)
enum values should have behavior opposite of the defaultfirst - The first enum value that should have behavior opposite of the default.second - The second enum value that should have behavior opposite of the default.java.lang.IllegalStateException - If the EnumSelector has been locked.allowAll(),
blockAll()public EnumSelector<T> apart(T... values)
enum values should have behavior opposite of the defaultvalues - The given enum values that should have behavior opposite of the default.java.lang.IllegalStateException - If the EnumSelector has been locked.allowAll(),
blockAll()public EnumSelector<T> apart(java.lang.Iterable<T> values)
enum values should have behavior opposite of the defaultvalues - The given enum values that should have behavior opposite of the default.java.lang.IllegalStateException - If the EnumSelector has been locked,
or if the values parameter is an EnumSelector instance which has
not been locked.allowAll(),
blockAll()public EnumSelector<T> lock()
java.lang.IllegalStateException - If the EnumSelector does not have specified default behavior.allowAll(),
blockAll(),
locked()public boolean locked()
public boolean allows(T value)
enum value is allowed by this EnumSelector.value - The enum value to test.enum value is allowed by this EnumSelector.java.lang.IllegalStateException - If the EnumSelector has not been locked.public boolean allowsAll()
java.lang.IllegalStateException - If the EnumSelector has not been locked.public boolean blocks(T value)
enum value is blocked by this EnumSelector.value - The enum value to test.enum value is blocked by this EnumSelector.java.lang.IllegalStateException - If the EnumSelector has not been locked.public boolean blocksAll()
java.lang.IllegalStateException - If the EnumSelector has not been locked.public java.util.Iterator<T> iterator()
public java.util.Spliterator<T> spliterator()
public java.util.stream.Stream<T> stream()
java.lang.IllegalStateException - If the EnumSelector has not been locked.public java.util.stream.Stream<T> parallelStream()
java.lang.IllegalStateException - If the EnumSelector has not been locked.public java.util.Set<T> toSet()
java.lang.IllegalStateException - If the EnumSelector has not been locked.public int size()
java.lang.IllegalStateException - If the EnumSelector has not been locked.public java.lang.String toString()
public int hashCode()
public boolean equals(java.lang.Object other)
equals in class java.lang.Objectjava.lang.IllegalStateException - If the EnumSelector has not been locked.AbstractSet.equals(Object)