|
Brooklyn | |||||||
FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectbrooklyn.util.config.ConfigBag
public class ConfigBag
Stores config in such a way that usage can be tracked. Either ConfigKey or java.lang.String keys can be inserted; they will be stored internally as strings. It is recommended to use ConfigKey instances to access, although in some cases (such as setting fields from flags, or copying a map) it may be necessary to mark things as used, or put, when only a string key is available.
Field Summary | |
---|---|
protected java.lang.String |
description
|
Method Summary | |
---|---|
ConfigBag
|
configure(ConfigKey key, java.lang.Object value)
as put(ConfigKey, Object) but returning this ConfigBag for fluent-style coding |
boolean
|
containsKey(HasConfigKey key)
|
boolean
|
containsKey(ConfigKey key)
|
boolean
|
containsKey(java.lang.String key)
|
ConfigBag
|
copy(ConfigBag other)
|
java.lang.Object
|
get(ConfigKey key)
returns the value of this config key, falling back to its default (use containsKey to see whether it was contained); also marks it as having been used (use peek to prevent marking as used) |
protected java.lang.Object
|
get(ConfigKey key, boolean remove)
|
java.util.Map
|
getAllConfig()
current values for all entries |
java.util.Map
|
getAllConfigRaw()
internal map containing the current values for all entries; for use where the caller wants to modify this directly and knows it is safe to do so |
java.lang.String
|
getDescription()
optional description used to provide context for operations |
java.lang.Object
|
getStringKey(java.lang.String key)
gets a value from a string-valued key; ConfigKey is preferred, but this is useful in some contexts (e.g. setting from flags) |
protected java.lang.Object
|
getStringKey(java.lang.String key, boolean remove)
|
java.util.Map
|
getUnusedConfig()
current values for all entries which have not yet been used |
java.util.Map
|
getUnusedConfigRaw()
internal map containing the current values for all entries which have not yet been used; for use where the caller wants to modify this directly and knows it is safe to do so |
boolean
|
isUnused(ConfigKey key)
|
ConfigBag
|
markAll(java.lang.Iterable usedFlags)
|
void
|
markFlagUsed(java.lang.String key)
@deprecated don't use, remove ASAP |
void
|
markUsed(java.lang.String key)
indicates that a string key in the config map has been accessed |
static ConfigBag
|
newInstanceCopying(ConfigBag configBag)
creates a new ConfigBag instance which includes all of the supplied ConfigBag's values, but which tracks usage separately (already used values are marked as such, but uses in the original set will not be marked here, and vice versa) |
static ConfigBag
|
newInstanceExtending(ConfigBag configBag, java.util.Map flags)
creates a new ConfigBag instance which includes all of the supplied ConfigBag's values,
plus an additional set of |
java.lang.Object
|
peek(ConfigKey key)
like get, but without marking it as used |
java.lang.Object
|
put(ConfigKey key, java.lang.Object value)
|
ConfigBag
|
putAll(java.util.Map addlConfig)
|
protected void
|
putAsStringKey(java.lang.Object key, java.lang.Object value)
|
void
|
putIfNotNull(ConfigKey key, java.lang.Object value)
|
java.lang.Object
|
putStringKey(java.lang.String key, java.lang.Object value)
recommended to use put(ConfigKey, Object) but there are times (e.g. when copying a map) where we want to put a string key directly @return |
void
|
remove(ConfigKey key)
|
void
|
remove(java.lang.String key)
|
ConfigBag
|
removeAll(ConfigKey... keys)
|
ConfigBag
|
removeAll(java.lang.Iterable keys)
|
ConfigBag
|
setDescription(java.lang.String description)
|
Methods inherited from class java.lang.Object | |
---|---|
java.lang.Object#wait(), java.lang.Object#wait(long), java.lang.Object#wait(long, int), java.lang.Object#equals(java.lang.Object), java.lang.Object#toString(), java.lang.Object#hashCode(), java.lang.Object#getClass(), java.lang.Object#notify(), java.lang.Object#notifyAll() |
Field Detail |
---|
protected java.lang.String description
Method Detail |
---|
public ConfigBag configure(ConfigKey key, java.lang.Object value)
public boolean containsKey(HasConfigKey key)
public boolean containsKey(ConfigKey key)
public boolean containsKey(java.lang.String key)
public ConfigBag copy(ConfigBag other)
public java.lang.Object get(ConfigKey key)
protected java.lang.Object get(ConfigKey key, boolean remove)
public java.util.Map getAllConfig()
public java.util.Map getAllConfigRaw()
public java.lang.String getDescription()
public java.lang.Object getStringKey(java.lang.String key)
protected java.lang.Object getStringKey(java.lang.String key, boolean remove)
public java.util.Map getUnusedConfig()
public java.util.Map getUnusedConfigRaw()
public boolean isUnused(ConfigKey key)
public ConfigBag markAll(java.lang.Iterable usedFlags)
public void markFlagUsed(java.lang.String key)
public void markUsed(java.lang.String key)
public static ConfigBag newInstanceCopying(ConfigBag configBag)
public static ConfigBag newInstanceExtending(ConfigBag configBag, java.util.Map flags)
values from the original set which are used here will be marked as used in the original set (note: this applies even for values which are overridden and the overridden value is used); however subsequent uses in the original set will not be marked here
public java.lang.Object peek(ConfigKey key)
@SuppressWarnings("unchecked") public java.lang.Object put(ConfigKey key, java.lang.Object value)
public ConfigBag putAll(java.util.Map addlConfig)
protected void putAsStringKey(java.lang.Object key, java.lang.Object value)
public void putIfNotNull(ConfigKey key, java.lang.Object value)
public java.lang.Object putStringKey(java.lang.String key, java.lang.Object value)
public void remove(ConfigKey key)
public void remove(java.lang.String key)
public ConfigBag removeAll(ConfigKey... keys)
public ConfigBag removeAll(java.lang.Iterable keys)
public ConfigBag setDescription(java.lang.String description)
Brooklyn Multi-Cloud Application Management Platform
brooklyncentral.github.com. Apache License. © 2012.