public final class AttributeMap
extends java.lang.Object
implements java.io.Serializable
Map
of Entity
attribute values.Constructor and Description |
---|
AttributeMap(AbstractEntity entity,
java.util.Map<java.util.Collection<java.lang.String>,java.lang.Object> storage)
Creates a new AttributeMap.
|
Modifier and Type | Method and Description |
---|---|
java.util.Map<java.lang.String,java.lang.Object> |
asMap() |
java.util.Map<java.util.Collection<java.lang.String>,java.lang.Object> |
asRawMap() |
<T> T |
getValue(AttributeSensor<T> sensor) |
java.lang.Object |
getValue(java.util.Collection<java.lang.String> path)
Gets the value
|
<T> T |
modify(AttributeSensor<T> attribute,
com.google.common.base.Function<? super T,Maybe<T>> modifier)
Where atomicity is desired, the methods in this class synchronize on the
values map. |
void |
remove(AttributeSensor<?> attribute) |
void |
remove(java.util.Collection<java.lang.String> path) |
<T> T |
update(AttributeSensor<T> attribute,
T newValue) |
<T> T |
update(java.util.Collection<java.lang.String> path,
T newValue)
Updates the value.
|
<T> T |
updateWithoutPublishing(AttributeSensor<T> attribute,
T newValue) |
public AttributeMap(AbstractEntity entity, java.util.Map<java.util.Collection<java.lang.String>,java.lang.Object> storage)
entity
- the EntityLocal this AttributeMap belongs to.java.lang.IllegalArgumentException
- if entity is nullpublic java.util.Map<java.util.Collection<java.lang.String>,java.lang.Object> asRawMap()
public java.util.Map<java.lang.String,java.lang.Object> asMap()
public <T> T update(java.util.Collection<java.lang.String> path, T newValue)
path
- the path to the value.newValue
- the new valuejava.lang.IllegalArgumentException
- if path is null or emptypublic <T> T update(AttributeSensor<T> attribute, T newValue)
public <T> T updateWithoutPublishing(AttributeSensor<T> attribute, T newValue)
public <T> T modify(AttributeSensor<T> attribute, com.google.common.base.Function<? super T,Maybe<T>> modifier)
values
map.public void remove(AttributeSensor<?> attribute)
public void remove(java.util.Collection<java.lang.String> path)
public java.lang.Object getValue(java.util.Collection<java.lang.String> path)
path
- the path of the value to getjava.lang.IllegalArgumentException
- path is null or empty.public <T> T getValue(AttributeSensor<T> sensor)