public class MonitorField extends Object
Instances can be registered as default handlers for data channel attribute keys.
Equality and hash code are based on the object identity.
| Modifier and Type | Field and Description |
|---|---|
static MonitorField |
ALERT_HIGH |
static MonitorField |
ALERT_LOW |
static MonitorField |
DESCR |
static MonitorField |
HIGH_ALARM |
static MonitorField |
HIGH_WARN |
protected String |
key |
static MonitorField |
LOW_ALARM |
static MonitorField |
LOW_WARN |
static MonitorField |
NAME |
static MonitorField |
NULL |
protected FormattedValue |
template |
protected String |
title |
static MonitorField |
UNITS |
static MonitorField |
VALUE |
| Constructor and Description |
|---|
MonitorField(String key,
String title,
FormattedValue template)
Constructs an instance.
|
| Modifier and Type | Method and Description |
|---|---|
FormattedValue |
format(AgentChannel channel)
Returns the current formatted value of this field in the specified data channel,
or
null if this field does not define custom formatting. |
static List<MonitorField> |
getAffectedFields(Collection<String> keys) |
static List<MonitorField> |
getAffectedFields(Collection<String> keys,
Collection<MonitorField> fields) |
static List<MonitorField> |
getDefaultFields(Collection<String> keys) |
static MonitorField |
getInstance(String key)
Returns an instance registered as the default handler for the specified attribute key.
|
String |
getKey()
Returns a unique getKey of this field.
|
Set<String> |
getKeys()
Returns a set of keys of data channel attributes that might effect the value of this field or its formatting.
|
String |
getTitle()
Returns human readable title associated with this field.
|
Object |
getValue(AgentChannel channel)
Returns the current value of this field in the specified data channel, or
null
if the channel does not contain a value for this field. |
boolean |
isUpdatable() |
static void |
registerInstance(MonitorField field)
Registers the specified instance as the default handler for the attribute
identified by the key returned by its
getKey() method. |
void |
setValue(Object value,
AgentChannel channel) |
String |
toString()
Returns the human readable title of this field.
|
static MonitorField |
valueOf(String key)
Returns an instance registered as the default handler for the attribute identified
by the specified key, or
null if no such instance exists. |
public static final MonitorField NULL
public static final MonitorField NAME
public static final MonitorField VALUE
public static final MonitorField UNITS
public static final MonitorField LOW_ALARM
public static final MonitorField LOW_WARN
public static final MonitorField ALERT_LOW
public static final MonitorField HIGH_ALARM
public static final MonitorField HIGH_WARN
public static final MonitorField ALERT_HIGH
public static final MonitorField DESCR
protected final String key
protected final String title
protected final FormattedValue template
public MonitorField(String key, String title, FormattedValue template)
key - Attribute key. Unless overridden, getKey() and getKeys()
methods will return this key and a singleton set containing this key, respectively.
The getValue(channel) method will return the value of the data channel attribute
identified by this key.title - Human readable title.template - Formatted value template.public static void registerInstance(MonitorField field)
getKey() method.field - Instance to register.IllegalArgumentException - if an instance with this key already registered.public static MonitorField getInstance(String key)
new MonitorField(key, key, null).key - Attribute key.public static MonitorField valueOf(String key)
null if no such instance exists.key - Attribute key.null if no such instance exists.public static List<MonitorField> getDefaultFields(Collection<String> keys)
public static List<MonitorField> getAffectedFields(Collection<String> keys, Collection<MonitorField> fields)
public static List<MonitorField> getAffectedFields(Collection<String> keys)
public Object getValue(AgentChannel channel)
null
if the channel does not contain a value for this field.channel - Data channel.public void setValue(Object value, AgentChannel channel)
public String getKey()
public String getTitle()
public Set<String> getKeys()
public boolean isUpdatable()
public FormattedValue format(AgentChannel channel)
null if this field does not define custom formatting. In the latter case,
clients are expected to format the raw value returned by the getValue(AgentChannel)
method, possibly taking into account values returned by other getters.
The default implementation returns a new instance with the value field set to the object returned by
getValue(), and all other fields set according to the template supplied to this field constructor.
Some of the standard fields override this method, providing custom formatting.
channel - Data channel.Copyright © 2018 LSST. All rights reserved.