public class EntityConfigMap extends AbstractConfigMapImpl
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) |
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<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 |
setConfig(ConfigKey<?> key,
java.lang.Object v) |
void |
setInheritedConfig(java.util.Map<ConfigKey<?>,?> valsO,
ConfigBag configBagVals) |
void |
setLocalConfig(java.util.Map<ConfigKey<?>,?> vals) |
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() |
asMapWithStringKeys, getConfig, getConfig, getConfig, getRawConfig, isEmpty, size
public EntityConfigMap(AbstractEntity entity, java.util.Map<ConfigKey<?>,java.lang.Object> storage)
public <T> T getConfig(ConfigKey<T> key, T defaultValue)
ConfigMap
public Maybe<java.lang.Object> getConfigRaw(ConfigKey<?> key, boolean includeInherited)
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()
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<?>,?> vals)
public void setInheritedConfig(java.util.Map<ConfigKey<?>,?> valsO, 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