public class SimpleFlagRegistry extends java.lang.Object implements FlagRegistry
| Constructor and Description |
|---|
SimpleFlagRegistry() |
| Modifier and Type | Method and Description |
|---|---|
Flag<?> |
get(java.lang.String name)
Get af flag by its name.
|
java.util.List<Flag<?>> |
getAll()
Get all flags
|
boolean |
isInitialized() |
java.util.Iterator<Flag<?>> |
iterator() |
void |
register(Flag<?> flag)
Register a new flag.
|
void |
registerAll(java.util.Collection<Flag<?>> flags)
Register a collection of flags.
|
void |
setInitialized(boolean initialized) |
int |
size()
Get the number of registered flags.
|
java.util.Map<Flag<?>,java.lang.Object> |
unmarshal(java.util.Map<java.lang.String,java.lang.Object> rawValues,
boolean createUnknown)
Unmarshal a raw map of values into a map of flags with their
unmarshalled values.
|
public boolean isInitialized()
public void setInitialized(boolean initialized)
public void register(Flag<?> flag) throws FlagConflictException
FlagRegistryThere may be an appropriate time to register flags. If flags are registered outside this time, then an exception may be thrown.
register in interface FlagRegistryflag - The flagFlagConflictException - Thrown when an existing flag exists with the same namepublic void registerAll(java.util.Collection<Flag<?>> flags)
FlagRegistryThere 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.
registerAll in interface FlagRegistryflags - a collection of flags@Nullable public Flag<?> get(java.lang.String name)
FlagRegistryget in interface FlagRegistryname - The namepublic java.util.List<Flag<?>> getAll()
FlagRegistrygetAll in interface FlagRegistrypublic java.util.Map<Flag<?>,java.lang.Object> unmarshal(java.util.Map<java.lang.String,java.lang.Object> rawValues, boolean createUnknown)
FlagRegistryunmarshal in interface FlagRegistryrawValues - The raw values mapcreateUnknown - Whether "just in time" flags should be created for unknown flagspublic int size()
FlagRegistrysize in interface FlagRegistry