StreamCapabilitiespublic final class FlagSet<E extends java.lang.Enum<E>> extends java.lang.Object implements StreamCapabilities
ConfigurationHelper.parseEnumSet(String, String, Class, boolean)
and implementing StreamCapabilities.
Thread safety: there is no synchronization on a mutable FlagSet.
Once declared immutable, flags cannot be changed, so they
becomes implicitly thread-safe.
StreamCapabilities.StreamCapabilityABORTABLE_STREAM, DROPBEHIND, HFLUSH, HSYNC, IOSTATISTICS, IOSTATISTICS_CONTEXT, PREADBYTEBUFFER, READAHEAD, READBYTEBUFFER, UNBUFFER, VECTOREDIO| Modifier and Type | Method | Description |
|---|---|---|
static <E extends java.lang.Enum<E>> |
buildFlagSet(java.lang.Class<E> enumClass,
Configuration conf,
java.lang.String key,
boolean ignoreUnknown) |
Build a FlagSet from a comma separated list of values.
|
FlagSet<E> |
copy() |
Create a copy of the FlagSet.
|
static <E extends java.lang.Enum<E>> |
createFlagSet(java.lang.Class<E> enumClass,
java.lang.String prefix,
E... enabled) |
Create a FlagSet from a list of enum values.
|
static <E extends java.lang.Enum<E>> |
createFlagSet(java.lang.Class<E> enumClass,
java.lang.String prefix,
java.util.EnumSet<E> flags) |
Create a FlagSet.
|
void |
disable(E flag) |
Disable a flag.
|
void |
enable(E flag) |
Enable a flag.
|
boolean |
enabled(E flag) |
Is a flag enabled?
|
boolean |
equals(java.lang.Object o) |
|
java.util.EnumSet<E> |
flags() |
Get a copy of the flags.
|
java.lang.Class<E> |
getEnumClass() |
Get the enum class.
|
boolean |
hasCapability(java.lang.String capability) |
Is a flag enabled?
|
int |
hashCode() |
Hash code is based on the flags.
|
boolean |
isEmpty() |
Probe for the FlagSet being empty.
|
boolean |
isImmutable() |
Is the FlagSet immutable?
|
void |
makeImmutable() |
Make immutable; no-op if already set.
|
java.util.List<java.lang.String> |
pathCapabilities() |
Generate the list of capabilities.
|
void |
set(E flag,
boolean state) |
Set a flag to the chosen value.
|
java.lang.String |
toConfigurationString() |
Convert to a string which can be then set in a configuration.
|
java.lang.String |
toString() |
public java.util.EnumSet<E> flags()
This is immutable.
public boolean isEmpty()
public boolean enabled(E flag)
flag - flag to checkpublic void enable(E flag)
flag - flag to enable.public void disable(E flag)
flag - flag to disablepublic void set(E flag, boolean state)
flag - flagstate - true to enable, false to disable.public boolean hasCapability(java.lang.String capability)
hasCapability in interface StreamCapabilitiescapability - string to query the stream support for.public void makeImmutable()
public boolean isImmutable()
public java.lang.Class<E> getEnumClass()
public java.lang.String toString()
toString in class java.lang.Objectpublic java.util.List<java.lang.String> pathCapabilities()
public boolean equals(java.lang.Object o)
enumClass and
prefix and the contents of the set, which must match.
The immutability flag is not considered, nor is the
namesToValues map, though as that is generated from
the enumeration and prefix, it is implicitly equal if the prefix
and enumClass fields are equal.
equals in class java.lang.Objecto - other objectpublic int hashCode()
hashCode in class java.lang.Objectpublic FlagSet<E> copy()
public java.lang.String toConfigurationString()
public static <E extends java.lang.Enum<E>> FlagSet<E> createFlagSet(java.lang.Class<E> enumClass, java.lang.String prefix, java.util.EnumSet<E> flags)
E - enum typeenumClass - class of enumprefix - prefix (with trailing ".") for path capabilities probeflags - flags@SafeVarargs public static <E extends java.lang.Enum<E>> FlagSet<E> createFlagSet(java.lang.Class<E> enumClass, java.lang.String prefix, E... enabled)
E - enum typeenumClass - class of enumprefix - prefix (with trailing ".") for path capabilities probeenabled - varags list of flags to enable.public static <E extends java.lang.Enum<E>> FlagSet<E> buildFlagSet(java.lang.Class<E> enumClass, Configuration conf, java.lang.String key, boolean ignoreUnknown)
E - enumeration typeenumClass - class of enumconf - configurationkey - key to look forignoreUnknown - should unknown values raise an exception?java.lang.IllegalArgumentException - if one of the entries was unknown and ignoreUnknown is false,
or there are two entries in the enum which differ only by case.Copyright © 2008–2025 Apache Software Foundation. All rights reserved.