com.custardsource.parfait.MonitoredConstant Maven / Gradle / Ivy
Show all versions of parfait-core Show documentation
package com.custardsource.parfait;
import javax.measure.unit.Unit;
/**
* MonitoredConstant provides an implementation of {@link Monitorable} for
* simple values that are rarely (read: never) updated, once initialised.
*
* This class should be used as for values which rarely change, such as the
* number of installed CPUs or the application version number.
*
* A setter exists for those cases where the value is not known until after
* creation (pre-registration of the Monitorable is required, but the value is
* not known at creation time), but this should not be called as a matter of
* course.
*/
public class MonitoredConstant extends SettableValue {
public MonitoredConstant(String name, String description, T initialValue) {
this(name, description, MonitorableRegistry.DEFAULT_REGISTRY,
initialValue);
}
public MonitoredConstant(String name, String description, T initialValue, Unit unit) {
this(name, description, MonitorableRegistry.DEFAULT_REGISTRY, initialValue, unit);
}
public MonitoredConstant(String name, String description, MonitorableRegistry registry,
T initialValue) {
this(name, description, registry, initialValue, Unit.ONE);
}
public MonitoredConstant(String name, String description, MonitorableRegistry registry,
T initialValue, Unit unit) {
super(name, description, registry, initialValue, unit, ValueSemantics.CONSTANT);
}
}