public class StaticSensor<T> extends AddSensor<T>
Task/Supplier values are resolved when written,
unlike config values which are resolved on each read.
This supports a AddSensor.SENSOR_PERIOD
which can be useful if the supplied value is such a function.
However when the source is another sensor,
consider using Propagator which listens for changes instead.
| Modifier and Type | Field and Description |
|---|---|
static ConfigKey<java.lang.Object> |
STATIC_VALUE |
SENSOR_NAME, SENSOR_PERIOD, SENSOR_TYPE| Constructor and Description |
|---|
StaticSensor(ConfigBag params) |
| Modifier and Type | Method and Description |
|---|---|
void |
apply(EntityLocal entity)
Applies initialization logic to a just-built entity.
|
public static final ConfigKey<java.lang.Object> STATIC_VALUE
public StaticSensor(ConfigBag params)
public void apply(EntityLocal entity)
EntityInitializerapply in interface EntityInitializerapply in class AddSensor<T>entity - guaranteed to be the actual implementation instance,
thus guaranteed to be castable to EntityInternal which is often desired,
or to the type at hand (it is not even a proxy)