Package cdc.util.cli
Class FeatureMask<E extends Enum<E>>
java.lang.Object
cdc.util.cli.FeatureMask<E>
- Type Parameters:
E- The feature enum type.
Utility to handle features.
- Author:
- Damien Carbonne
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionfinal voidfinal voidaddAll(FeatureMask<E> mask) final voidfinal voidaddAll(Collection<E> features) final booleancheckAtMostOne(org.apache.logging.log4j.Logger logger, FailureReaction reaction, E... features) Check that at most one feature is enabled in a group of features.final booleancheckExactlyOne(org.apache.logging.log4j.Logger logger, FailureReaction reaction, E... features) Check that exactly one feature is enabled in a group of features.final booleanbooleanisEmpty()final booleanfinal voidfinal voidsetEnabled(E feature, boolean enabled) toList()toSet()
-
Constructor Details
-
FeatureMask
public FeatureMask()
-
-
Method Details
-
setEnabled
-
add
-
addAll
-
addAll
-
addAll
-
remove
-
isEnabled
-
isEmpty
public boolean isEmpty() -
contains
-
toSet
-
toList
-
checkAtMostOne
@SafeVarargs public final boolean checkAtMostOne(org.apache.logging.log4j.Logger logger, FailureReaction reaction, E... features) Check that at most one feature is enabled in a group of features.- Parameters:
logger- The logger to use.reaction- The reaction to adopt in case of failure.features- The features.- Returns:
trueif at most one feature amongfeaturesis enabled in this FeatureMask.
-
checkExactlyOne
@SafeVarargs public final boolean checkExactlyOne(org.apache.logging.log4j.Logger logger, FailureReaction reaction, E... features) Check that exactly one feature is enabled in a group of features.- Parameters:
logger- The logger to use.reaction- The reaction to adopt in case of failure.features- The features.- Returns:
trueif exactly one feature amongfeaturesis enabled in this FeatureMask.
-