Constructor and Description |
---|
EntityConfigMap(AbstractEntity entity,
java.util.Map<ConfigKey<?>,java.lang.Object> storage) |
Modifier and Type | Method and Description |
---|---|
void |
addToLocalBag(java.util.Map<java.lang.String,?> vals) |
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
|
void |
clearInheritedConfig() |
java.util.Map<ConfigKey<?>,java.lang.Object> |
getAllConfig()
an immutable copy of the config visible at this entity, local and inherited (preferring local)
|
ConfigBag |
getAllConfigBag()
Creates an immutable copy of the config visible at this entity, local and inherited (preferring local), including those that did not match config keys
|
<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.util.Map<ConfigKey<?>,java.lang.Object> |
getLocalConfig()
an immutable copy of the config defined at this entity, ie not inherited
|
ConfigBag |
getLocalConfigBag()
Creates an immutable copy of the config defined at this entity, ie not inherited, including those that did not match config keys
|
java.lang.Object |
getRawConfig(ConfigKey<?> key)
Deprecated.
|
boolean |
isEmpty() |
java.lang.Object |
setConfig(ConfigKey<?> key,
java.lang.Object v) |
void |
setInheritedConfig(java.util.Map<ConfigKey<?>,? extends java.lang.Object> vals,
ConfigBag configBagVals) |
void |
setLocalConfig(java.util.Map<ConfigKey<?>,? extends java.lang.Object> vals) |
int |
size() |
EntityConfigMap |
submap(com.google.common.base.Predicate<ConfigKey<?>> filter)
returns submap matching the given filter predicate; see ConfigPredicates for common predicates
|
java.lang.String |
toString() |
public EntityConfigMap(AbstractEntity entity, java.util.Map<ConfigKey<?>,java.lang.Object> storage)
public <T> T getConfig(ConfigKey<T> key)
public <T> T getConfig(ConfigKey.HasConfigKey<T> key)
public <T> T getConfig(ConfigKey.HasConfigKey<T> key, T defaultValue)
public <T> T getConfig(ConfigKey<T> key, T defaultValue)
ConfigMap
@Deprecated public java.lang.Object getRawConfig(ConfigKey<?> key)
ConfigMap
#getConfigRaw(ConfigKey)
but returning null if not presentgetRawConfig
in interface ConfigMap
public Maybe<java.lang.Object> getConfigRaw(ConfigKey<?> key, boolean includeInherited)
ConfigMap
getConfigRaw
in interface ConfigMap
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()
getAllConfig
in interface ConfigMap
public java.util.Map<ConfigKey<?>,java.lang.Object> getLocalConfig()
public ConfigBag getAllConfigBag()
public ConfigBag getLocalConfigBag()
public java.lang.Object setConfig(ConfigKey<?> key, java.lang.Object v)
public void setLocalConfig(java.util.Map<ConfigKey<?>,? extends java.lang.Object> vals)
public void setInheritedConfig(java.util.Map<ConfigKey<?>,? extends java.lang.Object> vals, ConfigBag configBagVals)
public void addToLocalBag(java.util.Map<java.lang.String,?> vals)
public void clearInheritedConfig()
public EntityConfigMap submap(com.google.common.base.Predicate<ConfigKey<?>> filter)
ConfigMap
public java.lang.String toString()
toString
in class java.lang.Object
public java.util.Map<java.lang.String,java.lang.Object> asMapWithStringKeys()
ConfigMap
asMapWithStringKeys
in interface ConfigMap