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 | Class and Description |
|---|---|
static class |
MonitorField.Average |
| 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 |
protected Set<String> |
keys |
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(MonitorField other)
Deep copy constructor.
|
MonitorField(String key,
String title,
FormattedValue template)
Constructs an instance.
|
MonitorField(String key,
String title,
FormattedValue template,
Set<String> keys)
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. |
FormattedValue |
format(List<AgentChannel> channels)
Returns the current formatted value of this field for the specified list of channels,
or
null if this field does not define formatting for multiple channels. |
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 MonitorField(String key, String title, FormattedValue template, Set<String> keys)
key - Attribute key. Unless overridden, getKey() will return this key. 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.keys - Keys of attributes that might affect this field. If null, the field is assumed to be affected
by the attribute specified by the key argument. If that argument is null as well,
the field is not affected by any parameters.public MonitorField(MonitorField other)
other - Field to be cloned.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.channel - Data channel.public FormattedValue format(List<AgentChannel> channels)
null if this field does not define formatting for multiple channels.
The default implementation returns null.
channels - List of channels.Copyright © 2018 LSST. All rights reserved.