S
- source sensor typeTKey
- key type in target sensor mapTVal
- value type in target sensor mappublic class UpdatingMap<S,TKey,TVal> extends AbstractEnricher implements SensorEventListener<S>
TARGET_SENSOR
)
based on the value of another sensor (SOURCE_SENSOR
.
The key used defaults to the name of the source sensor but can be specified with KEY_IN_TARGET_SENSOR
.
The value placed in the map is the result of applying the function in COMPUTING
to the sensor value,
with default behaviour being to remove an entry if null
is returned
but this can be overriden by setting REMOVING_IF_RESULT_IS_NULL
false.
Entities.REMOVE
and Entities.UNCHANGED
are also respeced as return values for the computation
(ignoring generics).
Unlike most other enrichers, this defaults to AbstractEnricher.SUPPRESS_DUPLICATES
being true
AbstractEntityAdjunct.AdjunctTagSupport
BrooklynObject.TagSupport
Configurable.ConfigurationSupport
BrooklynObjectInternal.ConfigurationSupportInternal
Modifier and Type | Field and Description |
---|---|
static ConfigKey<com.google.common.base.Function<?,?>> |
COMPUTING |
static ConfigKey<?> |
KEY_IN_TARGET_SENSOR |
static ConfigKey<java.lang.Boolean> |
REMOVING_IF_RESULT_IS_NULL |
static ConfigKey<Sensor<?>> |
SOURCE_SENSOR |
static ConfigKey<Sensor<?>> |
TARGET_SENSOR |
SUPPRESS_DUPLICATES
NOOP
Constructor and Description |
---|
UpdatingMap() |
UpdatingMap(java.util.Map<java.lang.Object,java.lang.Object> flags) |
Modifier and Type | Method and Description |
---|---|
void |
onEvent(SensorEvent<S> event)
The
SensorEvent handler method. |
void |
setEntity(EntityLocal entity) |
getEnricherType, getRebindSupport
config, configure, destroy, getAllConfig, getConfig, getConfigMap, getDisplayName, getName, getUniqueTag, isDestroyed, isRunning, setConfig, setDisplayName, setName, tags, toString
getCatalogItemId, getId, getManagementContext, getTagSupport, init, rebind, setCatalogItemId, setManagementContext
equals, getClass, hashCode, notify, notifyAll, wait, wait, wait
getAllConfig, getConfig, getId, getName, setConfig
getUniqueTag, isDestroyed, isRunning
getCatalogItemId, getDisplayName, getTagSupport, tags
config
setCatalogItemId
public static final ConfigKey<?> KEY_IN_TARGET_SENSOR
public static final ConfigKey<com.google.common.base.Function<?,?>> COMPUTING
public static final ConfigKey<java.lang.Boolean> REMOVING_IF_RESULT_IS_NULL
public UpdatingMap()
public UpdatingMap(java.util.Map<java.lang.Object,java.lang.Object> flags)
public void setEntity(EntityLocal entity)
setEntity
in class AbstractEnricher
public void onEvent(SensorEvent<S> event)
SensorEventListener
SensorEvent
handler method.onEvent
in interface SensorEventListener<S>