public abstract class Data extends Object implements Comparable<Data>
Data has an Id and a timestamp. The
timestamp is used to ensure that data is time-ordered when being sent into the alerting engine. If
not assigned the timestamp will be assigned to current time.
This provides a default implementation of compareTo(Data). Subclasses must Override this if
they are unhappy with the Natural Ordering provided: Id asc, Timestamp asc, Value asc
| Modifier and Type | Class and Description |
|---|---|
static class |
Data.Type |
| Modifier and Type | Field and Description |
|---|---|
protected Map<String,String> |
context |
protected String |
id |
protected long |
timestamp |
protected Data.Type |
type |
protected Object |
value |
| Constructor and Description |
|---|
Data() |
Data(String id,
long timestamp,
Object value,
Data.Type type) |
Data(String id,
long timestamp,
Object value,
Data.Type type,
Map<String,String> context) |
| Modifier and Type | Method and Description |
|---|---|
void |
addProperty(String name,
String value) |
int |
compareTo(Data o) |
boolean |
equals(Object o) |
Map<String,String> |
getContext() |
String |
getId() |
long |
getTimestamp() |
Data.Type |
getType() |
Object |
getValue() |
int |
hashCode() |
void |
setContext(Map<String,String> context) |
void |
setId(String id) |
void |
setTimestamp(long timestamp) |
void |
setType(Data.Type type) |
void |
setValue(Object value) |
String |
toString() |
protected String id
protected long timestamp
protected Object value
protected Data.Type type
public Data()
public Data(String id, long timestamp, Object value, Data.Type type)
id - not nulltimestamp - in millis, if less than 1 assigned currentTime.value - the valuetype - the type of datapublic Data(String id, long timestamp, Object value, Data.Type type, Map<String,String> context)
id - not nulltimestamp - in millis, if less than 1 assigned currentTime.value - the valuetype - the type of datacontext - optional, contextual name-value pairs to be stored with the data.public String getId()
public void setId(String id)
public long getTimestamp()
public void setTimestamp(long timestamp)
timestamp - in millis, if less than 1 assigned currentTime.public Object getValue()
public void setValue(Object value)
public Data.Type getType()
public void setType(Data.Type type)
public int compareTo(Data o)
compareTo in interface Comparable<Data>Copyright © 2015 Red Hat, Inc.. All rights reserved.