Interface FlagRegistry
- All Known Implementing Classes:
SimpleFlagRegistry
Keeps track of registered flags.
-
Method Summary
Modifier and TypeMethodDescriptionFlag<?>Get af flag by its name.getAll()Get all flagsvoidRegister a new flag.voidregisterAll(Collection<Flag<?>> flags)Register a collection of flags.intsize()Get the number of registered flags.Unmarshal a raw map of values into a map of flags with their unmarshalled values.Methods inherited from interface java.lang.Iterable
forEach, iterator, spliterator
-
Method Details
-
register
Register a new flag.There may be an appropriate time to register flags. If flags are registered outside this time, then an exception may be thrown.
- Parameters:
flag- The flag- Throws:
FlagConflictException- Thrown when an existing flag exists with the same nameIllegalStateException- If it is not the right time to register new flags
-
registerAll
Register a collection of flags.There may be an appropriate time to register flags. If flags are registered outside this time, then an exception may be thrown.
If there is a flag conflict, then an error will be logged but no exception will be thrown.
- Parameters:
flags- a collection of flags- Throws:
IllegalStateException- If it is not the right time to register new flags
-
get
Get af flag by its name.- Parameters:
name- The name- Returns:
- The flag, if it has been registered
-
getAll
Get all flags- Returns:
- All flags
-
unmarshal
Unmarshal a raw map of values into a map of flags with their unmarshalled values.- Parameters:
rawValues- The raw values mapcreateUnknown- Whether "just in time" flags should be created for unknown flags- Returns:
- The unmarshalled flag values map
-
size
int size()Get the number of registered flags.- Returns:
- The number of registered flags
-