public class EntityDynamicType extends BrooklynDynamicType<Entity,AbstractEntity>
EntityType
, and can change over time;
for this reason it does *not* implement EntityType, but
callers can call getSnapshot()
to get a snapshot such instanceConstructor and Description |
---|
EntityDynamicType(AbstractEntity entity) |
EntityDynamicType(java.lang.Class<? extends Entity> clazz) |
Modifier and Type | Method and Description |
---|---|
void |
addConfigKey(ConfigKey<?> newKey)
Adds the given
ConfigKey to this entity. |
void |
addConfigKeys(java.lang.Iterable<ConfigKey<?>> newKeys)
Adds the given
ConfigKey to this entity. |
void |
addEffector(Effector<?> newEffector)
Adds the given
Effector to this entity. |
<T> void |
addEffector(Effector<T> effector,
EffectorBody<T> body)
Adds an effector with an explicit body to this entity.
|
<T> void |
addEffector(Effector<T> effector,
EffectorTasks.EffectorTaskFactory<T> body)
Adds an effector with an explicit body to this entity.
|
void |
addSensor(Sensor<?> newSensor)
Adds the given
Sensor to this entity. |
void |
addSensorIfAbsent(Sensor<?> newSensor) |
Sensor<?> |
addSensorIfAbsentWithoutPublishing(Sensor<?> newSensor) |
void |
addSensors(java.lang.Iterable<? extends Sensor<?>> newSensors)
Adds the given
Sensor s to this entity. |
void |
clearConfigKeys() |
static java.util.Map<java.lang.String,Effector<?>> |
findEffectors(java.lang.Class<? extends Entity> clazz,
Entity optionalEntity)
Finds the effectors defined on the entity's class, statics and optionally any non-static (discouraged).
|
static java.util.Map<java.lang.String,Sensor<?>> |
findSensors(java.lang.Class<? extends Entity> clazz,
Entity optionalEntity)
Finds the sensors defined on the entity's class, statics and optionally any non-static (discouraged).
|
Effector<?> |
getEffector(java.lang.String name) |
java.util.Map<java.lang.String,Effector<?>> |
getEffectors()
Effectors available on this entity.
|
Sensor<?> |
getSensor(java.lang.String sensorName)
Convenience for finding named sensor.
|
java.util.Map<java.lang.String,Sensor<?>> |
getSensors()
Sensors available on this entity.
|
EntityType |
getSnapshot() |
boolean |
removeConfigKey(ConfigKey<?> key)
Removes the named
ConfigKey from this entity. |
void |
removeEffector(Effector<?> effector)
Removes the given
Effector from this entity. |
boolean |
removeSensor(Sensor<?> sensor)
Removes the named
Sensor from this entity. |
Sensor<?> |
removeSensor(java.lang.String sensorName)
Removes the named
Sensor from this entity. |
getBrooklynClass, getConfigKey, getConfigKeyField, getConfigKeys, setName
public EntityDynamicType(AbstractEntity entity)
public EntityDynamicType(java.lang.Class<? extends Entity> clazz)
public EntityType getSnapshot()
getSnapshot
in class BrooklynDynamicType<Entity,AbstractEntity>
public Effector<?> getEffector(java.lang.String name)
public java.util.Map<java.lang.String,Effector<?>> getEffectors()
public void addEffector(Effector<?> newEffector)
Effector
to this entity.public <T> void addEffector(Effector<T> effector, EffectorTasks.EffectorTaskFactory<T> body)
public <T> void addEffector(Effector<T> effector, EffectorBody<T> body)
public void removeEffector(Effector<?> effector)
Effector
from this entity.
Note that if the argument is an instance of EffectorWithBody
it will
still be possible to invoke the effector on the entity by calling
entity.invoke(effector, argumentsMap)
.
public java.util.Map<java.lang.String,Sensor<?>> getSensors()
public Sensor<?> getSensor(java.lang.String sensorName)
public void addSensors(java.lang.Iterable<? extends Sensor<?>> newSensors)
Sensor
s to this entity.public void addSensorIfAbsent(Sensor<?> newSensor)
public Sensor<?> addSensorIfAbsentWithoutPublishing(Sensor<?> newSensor)
public Sensor<?> removeSensor(java.lang.String sensorName)
Sensor
from this entity.public boolean removeSensor(Sensor<?> sensor)
Sensor
from this entity.public void addConfigKeys(java.lang.Iterable<ConfigKey<?>> newKeys)
ConfigKey
to this entity.public boolean removeConfigKey(ConfigKey<?> key)
ConfigKey
from this entity.public void clearConfigKeys()
public static java.util.Map<java.lang.String,Effector<?>> findEffectors(java.lang.Class<? extends Entity> clazz, Entity optionalEntity)