public interface FlagRegistry extends java.lang.Iterable<Flag<?>>
| 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
|
void |
register(Flag<?> flag)
Register a new flag.
|
void |
registerAll(java.util.Collection<Flag<?>> flags)
Register a collection of flags.
|
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.
|
void register(Flag<?> flag) throws FlagConflictException
There may be an appropriate time to register flags. If flags are registered outside this time, then an exception may be thrown.
flag - The flagFlagConflictException - Thrown when an existing flag exists with the same namejava.lang.IllegalStateException - If it is not the right time to register new flagsvoid registerAll(java.util.Collection<Flag<?>> 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.
flags - a collection of flagsjava.lang.IllegalStateException - If it is not the right time to register new flags@Nullable Flag<?> get(java.lang.String name)
name - The namejava.util.List<Flag<?>> getAll()
java.util.Map<Flag<?>,java.lang.Object> unmarshal(java.util.Map<java.lang.String,java.lang.Object> rawValues, boolean createUnknown)
rawValues - The raw values mapcreateUnknown - Whether "just in time" flags should be created for unknown flagsint size()