Package org.wildfly.common.format
Class GeneralFlags
- java.lang.Object
-
- java.util.AbstractCollection<E>
-
- java.util.AbstractSet<E>
-
- org.wildfly.common.flags.Flags<E,This>
-
- org.wildfly.common.format.GeneralFlags
-
- All Implemented Interfaces:
java.lang.Iterable<GeneralFlag>
,java.util.Collection<GeneralFlag>
,java.util.Set<GeneralFlag>
,java.util.SortedSet<GeneralFlag>
public final class GeneralFlags extends Flags<E,This>
-
-
Field Summary
Fields Modifier and Type Field Description static GeneralFlags
NONE
The empty set of general flags.
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description protected GeneralFlag
castItemOrNull(java.lang.Object obj)
Get the item (cast to the correctenum
type), ornull
if it is not of the correct type.protected GeneralFlags
castThis(java.lang.Object obj)
Cast the given object to this class, throwing an exception if the cast fails.void
forbid(E flag)
void
forbidAll()
void
forbidAllBut(E flag)
protected GeneralFlag
itemOf(int index)
Get the flag item with the given index.static GeneralFlags
of(GeneralFlag flag)
static GeneralFlags
of(GeneralFlag flag1, GeneralFlag flag2)
static GeneralFlags
of(GeneralFlag flag1, GeneralFlag flag2, GeneralFlag flag3)
protected GeneralFlags
this_()
Returnthis
.protected GeneralFlags
value(int bits)
Get the set value of the given bit combination.-
Methods inherited from class org.wildfly.common.flags.Flags
comparator, complement, contains, contains, containsAll, containsAll, containsAll, containsAll, containsAny, containsAny, containsAny, descendingIterator, equals, equals, equals, first, forEach, hashCode, headSet, isEmpty, iterator, last, size, subSet, tailSet, toArray, toArray, toString, with, with, with, with, with, without, without
-
-
-
-
Field Detail
-
NONE
public static final GeneralFlags NONE
The empty set of general flags.
-
-
Method Detail
-
of
public static GeneralFlags of(GeneralFlag flag)
-
of
public static GeneralFlags of(GeneralFlag flag1, GeneralFlag flag2)
-
of
public static GeneralFlags of(GeneralFlag flag1, GeneralFlag flag2, GeneralFlag flag3)
-
this_
protected GeneralFlags this_()
Description copied from class:Flags
Returnthis
.- Specified by:
this_
in classFlags<GeneralFlag,GeneralFlags>
- Returns:
this
-
value
protected GeneralFlags value(int bits)
Description copied from class:Flags
Get the set value of the given bit combination. The bit combination may contain extraneous one-bits so any bits beyond the bit of the last flag should be masked off if an array is used for lookup.- Specified by:
value
in classFlags<GeneralFlag,GeneralFlags>
- Parameters:
bits
- the bit combination (possibly with extra bits)- Returns:
- the set instance
-
itemOf
protected GeneralFlag itemOf(int index)
Description copied from class:Flags
Get the flag item with the given index.- Specified by:
itemOf
in classFlags<GeneralFlag,GeneralFlags>
- Parameters:
index
- the index- Returns:
- the flag
-
castItemOrNull
protected GeneralFlag castItemOrNull(java.lang.Object obj)
Description copied from class:Flags
Get the item (cast to the correctenum
type), ornull
if it is not of the correct type.- Specified by:
castItemOrNull
in classFlags<GeneralFlag,GeneralFlags>
- Parameters:
obj
- the object to cast- Returns:
- the cast object, or
null
-
castThis
protected GeneralFlags castThis(java.lang.Object obj)
Description copied from class:Flags
Cast the given object to this class, throwing an exception if the cast fails.- Specified by:
castThis
in classFlags<GeneralFlag,GeneralFlags>
- Parameters:
obj
- the object to cast- Returns:
- the cast object
-
forbidAll
public final void forbidAll()
-
forbidAllBut
public final void forbidAllBut(E flag)
-
forbid
public void forbid(E flag)
-
-