C
- the category enumpublic abstract class Health<C extends Enum<C>> extends Object implements Comparable<Health<C>>, Encodable
StateAggregator
or some subclass)
and set via the setAggregateState(com.hp.util.health.State)
method.
A timestamp records when the aggregate state was last updated.
Modifier | Constructor and Description |
---|---|
protected |
Health()
Constructs an instance of Health.
|
Modifier and Type | Method and Description |
---|---|
int |
compareTo(Health<C> o)
Compares this Health instance to the specified Health instance and
returns a value consistent with the contract for Comparable.
|
boolean |
equals(Object o) |
State |
getAggregateState()
Returns the aggregate state.
|
protected abstract Class<C> |
getCategoryEnumClass()
Subclasses must return the class of category enumeration that they
parameterized themselves with.
|
State |
getState(C category)
Returns the state for the specified category.
|
long |
getTimestamp()
Returns the timestamp of when the aggregate state was last updated.
|
int |
hashCode() |
void |
setState(C category,
State state)
Sets the specified state value for the given category.
|
String |
toDebugString()
Returns a multi-line string representation useful for debugging.
|
String |
toEncodedString()
Returns a string that is an encodement of this instance.
|
String |
toString() |
protected Health()
State.UNKNOWN
.public long getTimestamp()
public State getAggregateState()
public String toDebugString()
public void setState(C category, State state)
category
- the categorystate
- the stateNullPointerException
- if either category or state is nullpublic State getState(C category)
State.NORMAL
.category
- the required categoryNullPointerException
- if category is nullpublic int compareTo(Health<C> o)
This implementation compares the values in the aggregate state
fields.
public String toEncodedString()
Encodable
toEncodedString
in interface Encodable
protected abstract Class<C> getCategoryEnumClass()
Copyright © 2015. All Rights Reserved.