public abstract class AbstractConfigurationSupportInternal extends java.lang.Object implements BrooklynObjectInternal.ConfigurationSupportInternal
Constructor and Description |
---|
AbstractConfigurationSupportInternal() |
Modifier and Type | Method and Description |
---|---|
java.util.Set<ConfigKey<?>> |
findKeys(<any> filter)
Deprecated.
|
java.util.Set<ConfigKey<?>> |
findKeysDeclared(<any> filter)
see
ConfigMap#findKeysDeclared(Predicate) |
java.util.Set<ConfigKey<?>> |
findKeysPresent(<any> filter)
see
ConfigMap#findKeysPresent(Predicate) |
<T> T |
get(ConfigKey.HasConfigKey<T> key) |
<T> T |
get(ConfigKey<T> key)
Gets the given configuration value for this entity, in the following order of precedence:
value (including null) explicitly set on the entity
value (including null) explicitly set on an ancestor (inherited)
a default value (including null) on the best equivalent static key of the same name declared on the entity
(where best equivalence is defined as preferring a config key which extends another,
as computed in EntityDynamicType.getConfigKeys)
a default value (including null) on the key itself
null
|
java.util.Map<ConfigKey<?>,java.lang.Object> |
getAllLocalRaw()
Returns all config defined here, in
BrooklynObjectInternal.ConfigurationSupportInternal.getLocalRaw(ConfigKey) format |
ConfigBag |
getBag()
Returns a read-only view of all the config key/value pairs on this entity, backed by a string-based map,
including config names that did not match anything on this entity.
|
ConfigMap.ConfigMapWithInheritance<? extends BrooklynObject> |
getInternalConfigMap()
This is currently the only way to get some rolled up collections and raw,
and also to test for the presence of a value (without any default).
|
ConfigBag |
getLocalBag()
Returns a read-only view of the local (i.e.
|
Maybe<java.lang.Object> |
getLocalRaw(ConfigKey.HasConfigKey<?> key) |
Maybe<java.lang.Object> |
getLocalRaw(ConfigKey<?> key)
Returns the uncoerced value for this config key, if available,
not following any inheritance chains and not taking any default.
|
<T> Maybe<T> |
getNonBlocking(ConfigKey.HasConfigKey<T> key) |
<T> Maybe<T> |
getNonBlocking(ConfigKey<T> key)
Attempts to coerce the value for this config key, if available,
including returning a default if the config key is unset,
returning a
absent if the uncoerced
does not support immediate resolution. |
Maybe<java.lang.Object> |
getRaw(ConfigKey.HasConfigKey<?> key) |
Maybe<java.lang.Object> |
getRaw(ConfigKey<?> key)
Returns the uncoerced value for this config key, if available, not taking any default.
|
void |
putAll(java.util.Map<?,?> vals)
Adds keys or strings, making anonymous keys from strings; throws on other keys
|
void |
removeAllLocalConfig()
Clears all local config, e.g.
|
void |
removeKey(ConfigKey<?> key) |
void |
removeKey(java.lang.String key) |
<T> T |
set(ConfigKey.HasConfigKey<T> key,
T val) |
<T> T |
set(ConfigKey.HasConfigKey<T> key,
Task<T> val) |
<T> T |
set(ConfigKey<T> key,
T val)
Sets the config to the given value.
|
<T> T |
set(ConfigKey<T> key,
Task<T> val)
Sets the config to the value returned by the task.
|
void |
set(java.util.Map<?,?> vals)
Deprecated.
|
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
refreshInheritedConfig, refreshInheritedConfigOfChildren
public AbstractConfigurationSupportInternal()
public <T> T get(ConfigKey.HasConfigKey<T> key)
get
in interface Configurable.ConfigurationSupport
#get(ConfigKey)}
public Maybe<java.lang.Object> getLocalRaw(ConfigKey.HasConfigKey<?> key)
getLocalRaw
in interface BrooklynObjectInternal.ConfigurationSupportInternal
#getLocalRaw(ConfigKey)}
public Maybe<java.lang.Object> getRaw(ConfigKey.HasConfigKey<?> key)
getRaw
in interface BrooklynObjectInternal.ConfigurationSupportInternal
#getRaw(ConfigKey)}
public <T> Maybe<T> getNonBlocking(ConfigKey.HasConfigKey<T> key)
getNonBlocking
in interface BrooklynObjectInternal.ConfigurationSupportInternal
#getNonBlocking(ConfigKey)}
public <T> Maybe<T> getNonBlocking(ConfigKey<T> key)
BrooklynObjectInternal.ConfigurationSupportInternal
absent
if the uncoerced
does not support immediate resolution.
This also returns absent
if the value
or default value cannot be coerced to the type required by the key,
with coercion errors typically handled when setting or when getting
the "really needed" values, not when validating constraints which
is one of the main use cases of this method.
Note: if no value for the key is available, not even as a default,
this returns a Maybe.isPresent()
containing null
(following the semantics of Configurable.ConfigurationSupport.get(ConfigKey)
rather than BrooklynObjectInternal.ConfigurationSupportInternal.getRaw(ConfigKey)
).
Thus a Maybe.absent()
definitively indicates that
the absence is due to the request to evaluate immediately.
This will include catching ImmediateSupplier.ImmediateUnsupportedException
and returning it as an absence, thus making the semantics here slightly
"safer" than that of ImmediateSupplier.getImmediately()
.
getNonBlocking
in interface BrooklynObjectInternal.ConfigurationSupportInternal
public <T> T set(ConfigKey.HasConfigKey<T> key, Task<T> val)
set
in interface Configurable.ConfigurationSupport
#set(ConfigKey, Task)}
public <T> T set(ConfigKey.HasConfigKey<T> key, T val)
set
in interface Configurable.ConfigurationSupport
#set(ConfigKey, Object)}
public <T> T get(ConfigKey<T> key)
Configurable.ConfigurationSupport
get
in interface Configurable.ConfigurationSupport
public <T> T set(ConfigKey<T> key, T val)
Configurable.ConfigurationSupport
set
in interface Configurable.ConfigurationSupport
public <T> T set(ConfigKey<T> key, Task<T> val)
Configurable.ConfigurationSupport
Configurable.getConfig(ConfigKey)
will execute the task, and block until the task completes.set
in interface Configurable.ConfigurationSupport
public ConfigBag getLocalBag()
BrooklynObjectInternal.ConfigurationSupportInternal
getLocalBag
in interface BrooklynObjectInternal.ConfigurationSupportInternal
public Maybe<java.lang.Object> getRaw(ConfigKey<?> key)
BrooklynObjectInternal.ConfigurationSupportInternal
Maybe
-wrapped null if the value is explicitly null.
Returns Maybe.absent()
if the key is not explicitly set on this object or an ancestor.
Often this is used with Maybe#or(Object))
to return default value.
See also {@link #getLocalRaw(ConfigKey).
getRaw
in interface BrooklynObjectInternal.ConfigurationSupportInternal
public Maybe<java.lang.Object> getLocalRaw(ConfigKey<?> key)
BrooklynObjectInternal.ConfigurationSupportInternal
Maybe.absent()
if the key is not explicitly set on this object.
See also {@link #getRaw(ConfigKey).
getLocalRaw
in interface BrooklynObjectInternal.ConfigurationSupportInternal
public void putAll(java.util.Map<?,?> vals)
BrooklynObjectInternal.ConfigurationSupportInternal
putAll
in interface BrooklynObjectInternal.ConfigurationSupportInternal
@Deprecated public void set(java.util.Map<?,?> vals)
set
in interface BrooklynObjectInternal.ConfigurationSupportInternal
public void removeKey(java.lang.String key)
removeKey
in interface BrooklynObjectInternal.ConfigurationSupportInternal
public void removeKey(ConfigKey<?> key)
removeKey
in interface BrooklynObjectInternal.ConfigurationSupportInternal
public void removeAllLocalConfig()
BrooklynObjectInternal.ConfigurationSupportInternal
removeAllLocalConfig
in interface BrooklynObjectInternal.ConfigurationSupportInternal
@Deprecated public java.util.Set<ConfigKey<?>> findKeys(<any> filter)
findKeys
in interface Configurable.ConfigurationSupport
public java.util.Set<ConfigKey<?>> findKeysDeclared(<any> filter)
Configurable.ConfigurationSupport
ConfigMap#findKeysDeclared(Predicate)
findKeysDeclared
in interface Configurable.ConfigurationSupport
public java.util.Set<ConfigKey<?>> findKeysPresent(<any> filter)
Configurable.ConfigurationSupport
ConfigMap#findKeysPresent(Predicate)
findKeysPresent
in interface Configurable.ConfigurationSupport
public ConfigMap.ConfigMapWithInheritance<? extends BrooklynObject> getInternalConfigMap()
BrooklynObjectInternal.ConfigurationSupportInternal
#findKeysDeclared(com.google.common.base.Predicate)
although efficiency should be considered (this gives direct access whereas that does lookups and copies).getInternalConfigMap
in interface BrooklynObjectInternal.ConfigurationSupportInternal
public java.util.Map<ConfigKey<?>,java.lang.Object> getAllLocalRaw()
BrooklynObjectInternal.ConfigurationSupportInternal
BrooklynObjectInternal.ConfigurationSupportInternal.getLocalRaw(ConfigKey)
formatgetAllLocalRaw
in interface BrooklynObjectInternal.ConfigurationSupportInternal
public ConfigBag getBag()
BrooklynObjectInternal.ConfigurationSupportInternal
ConfigKey.getInheritanceByContext()
cannot be respected
if an anonymous key (not matching a declared config key) is set but the
strongly typed key is accessed.
It does not identify the container where it is defined, meaning URLs and deferred config values cannot be resolved in the context of the appropriate ancestor.
For these reasons it is recommended to use a different accessor, and callers should be advised this beta method may be removed.
getBag
in interface BrooklynObjectInternal.ConfigurationSupportInternal