public class BrooklynPropertiesImpl extends java.util.LinkedHashMap implements BrooklynProperties
Modifier and Type | Class and Description |
---|---|
static class |
BrooklynPropertiesImpl.Factory |
Modifier and Type | Method and Description |
---|---|
BrooklynPropertiesImpl |
addEnvironmentVars() |
BrooklynPropertiesImpl |
addFrom(ConfigBag cfg) |
BrooklynPropertiesImpl |
addFrom(java.io.File f) |
BrooklynPropertiesImpl |
addFrom(java.io.InputStream i) |
BrooklynPropertiesImpl |
addFrom(java.util.Map map) |
BrooklynPropertiesImpl |
addFrom(java.net.URL u) |
BrooklynPropertiesImpl |
addFromMap(java.util.Map properties)
adds the indicated properties
|
BrooklynPropertiesImpl |
addFromUrl(java.lang.String url) |
BrooklynPropertiesImpl |
addFromUrlProperty(java.lang.String urlProperty)
expects a property already set in scope, whose value is acceptable to
addFromUrl(String) ;
if property not set, does nothing |
BrooklynPropertiesImpl |
addSystemProperties() |
java.util.Map<java.lang.String,java.lang.Object> |
asMapWithStringKeys()
returns a read-only map view which has string keys (corresponding to the config key names);
callers encouraged to use the typed keys (and so not use this method),
but in some compatibility areas having a Properties-like view is useful
|
java.lang.String |
get(java.util.Map flags,
java.lang.String key)
Deprecated.
attempts to call get with this syntax are probably mistakes; get(key, defaultValue) is fine but
Map is unlikely the key, much more likely they meant getFirst(flags, key).
|
java.util.Map<ConfigKey<?>,java.lang.Object> |
getAllConfig()
returns a map of all config keys to their raw (unresolved+uncoerced) contents
|
<T> T |
getConfig(ConfigKey.HasConfigKey<T> key) |
<T> T |
getConfig(ConfigKey.HasConfigKey<T> key,
T defaultValue) |
<T> T |
getConfig(ConfigKey<T> key) |
<T> T |
getConfig(ConfigKey<T> key,
T defaultValue)
Returns value stored against the given key,
resolved (if it is a Task, possibly blocking), and coerced to the appropriate type,
or given default value if not set,
unless the default value is null in which case it returns the default.
|
Maybe<java.lang.Object> |
getConfigRaw(ConfigKey<?> key,
boolean includeInherited)
returns the value stored against the given key,
not any default,
not resolved (and guaranteed non-blocking),
and not type-coerced.
|
java.lang.String |
getFirst(java.util.Map flags,
java.lang.String... keys)
returns the value of the first key which is defined
|
java.lang.String |
getFirst(java.lang.String... keys)
returns the value of the first key which is defined
|
java.lang.Object |
getRawConfig(ConfigKey<?> key)
as
#getConfigRaw(ConfigKey) but returning null if not present |
<T> java.lang.Object |
put(ConfigKey.HasConfigKey<T> key,
T value) |
<T> java.lang.Object |
put(ConfigKey<T> key,
T value) |
java.lang.Object |
put(java.lang.Object key,
java.lang.Object value)
like normal map.put, except config keys are dereferenced on the way in
|
void |
putAll(java.util.Map vals)
like normal map.putAll, except config keys are dereferenced on the way in
|
<T> boolean |
putIfAbsent(ConfigKey<T> key,
T value) |
boolean |
putIfAbsent(java.lang.String key,
java.lang.Object value)
inserts the value under the given key, if it was not present
|
BrooklynPropertiesImpl |
submap(
returns submap matching the given filter predicate; see ConfigPredicates for common predicates
|
java.lang.String |
toString() |
clone, containsKey, entrySet, isEmpty, keySet, remove, size, values
public BrooklynPropertiesImpl addEnvironmentVars()
addEnvironmentVars
in interface BrooklynProperties
public BrooklynPropertiesImpl addSystemProperties()
addSystemProperties
in interface BrooklynProperties
public BrooklynPropertiesImpl addFrom(ConfigBag cfg)
addFrom
in interface BrooklynProperties
public BrooklynPropertiesImpl addFrom(java.util.Map map)
addFrom
in interface BrooklynProperties
public BrooklynPropertiesImpl addFrom(java.io.InputStream i)
addFrom
in interface BrooklynProperties
public BrooklynPropertiesImpl addFrom(java.io.File f)
addFrom
in interface BrooklynProperties
public BrooklynPropertiesImpl addFrom(java.net.URL u)
addFrom
in interface BrooklynProperties
public BrooklynPropertiesImpl addFromUrl(java.lang.String url)
public BrooklynPropertiesImpl addFromUrlProperty(java.lang.String urlProperty)
addFromUrl(String)
;
if property not set, does nothingaddFromUrlProperty
in interface BrooklynProperties
public BrooklynPropertiesImpl addFromMap(java.util.Map properties)
addFromMap
in interface BrooklynProperties
public boolean putIfAbsent(java.lang.String key, java.lang.Object value)
putIfAbsent
in interface BrooklynProperties
@Deprecated public java.lang.String get(java.util.Map flags, java.lang.String key)
get
in interface BrooklynProperties
public java.lang.String getFirst(java.lang.String... keys)
takes the following flags: 'warnIfNone', 'failIfNone' (both taking a boolean (to use default message) or a string (which is the message)); and 'defaultIfNone' (a default value to return if there is no such property); defaults to no warning and null response
getFirst
in interface StringConfigMap
getFirst
in interface BrooklynProperties
StringConfigMap.getFirst(java.util.Map, String...)
public java.lang.String getFirst(java.util.Map flags, java.lang.String... keys)
StringConfigMap
takes the following flags: 'warnIfNone' or 'failIfNone' (both taking a boolean (to use default message) or a string (which is the message)); and 'defaultIfNone' (a default value to return if there is no such property); defaults to no warning and null default value
getFirst
in interface StringConfigMap
getFirst
in interface BrooklynProperties
public java.lang.String toString()
toString
in class java.util.AbstractMap
public java.lang.Object put(java.lang.Object key, java.lang.Object value)
put
in interface java.util.Map
put
in interface BrooklynProperties
put
in class java.util.HashMap
public void putAll(java.util.Map vals)
putAll
in interface java.util.Map
putAll
in interface BrooklynProperties
putAll
in class java.util.HashMap
public <T> java.lang.Object put(ConfigKey.HasConfigKey<T> key, T value)
put
in interface BrooklynProperties
public <T> java.lang.Object put(ConfigKey<T> key, T value)
put
in interface BrooklynProperties
public <T> boolean putIfAbsent(ConfigKey<T> key, T value)
putIfAbsent
in interface BrooklynProperties
public <T> T getConfig(ConfigKey<T> key)
getConfig
in interface ConfigMap
getConfig
in interface BrooklynProperties
#getConfig(ConfigKey, Object), with default value as per the key, or null
public <T> T getConfig(ConfigKey.HasConfigKey<T> key)
getConfig
in interface ConfigMap
getConfig
in interface BrooklynProperties
#getConfig(ConfigKey, Object), with default value as per the key, or null
public <T> T getConfig(ConfigKey.HasConfigKey<T> key, T defaultValue)
getConfig
in interface ConfigMap
getConfig
in interface BrooklynProperties
#getConfig(ConfigKey, Object), with provided default value if not set
public <T> T getConfig(ConfigKey<T> key, T defaultValue)
ConfigMap
getConfig
in interface ConfigMap
getConfig
in interface BrooklynProperties
public java.lang.Object getRawConfig(ConfigKey<?> key)
ConfigMap
#getConfigRaw(ConfigKey)
but returning null if not presentgetRawConfig
in interface ConfigMap
getRawConfig
in interface BrooklynProperties
public Maybe<java.lang.Object> getConfigRaw(ConfigKey<?> key, boolean includeInherited)
ConfigMap
getConfigRaw
in interface ConfigMap
getConfigRaw
in interface BrooklynProperties
key
- key to look upincludeInherited
- for ConfigMap
instances which have an inheritance hierarchy,
whether to traverse it or not; has no effects where there is no inheritancepublic java.util.Map<ConfigKey<?>,java.lang.Object> getAllConfig()
ConfigMap
getAllConfig
in interface ConfigMap
getAllConfig
in interface BrooklynProperties
public BrooklynPropertiesImpl submap(filter)
ConfigMap
submap
in interface ConfigMap
submap
in interface BrooklynProperties
public java.util.Map<java.lang.String,java.lang.Object> asMapWithStringKeys()
ConfigMap
asMapWithStringKeys
in interface ConfigMap
asMapWithStringKeys
in interface BrooklynProperties