public final class StatusVariable
extends java.lang.Object
StatusVariable object represents the value of a status variable
taken with a certain collection method at a certain point of time. The type
of the StatusVariable can be int, float,
boolean or String.
A StatusVariable is identified by an ID string that is unique within
the scope of a Monitorable. The ID must be a non- null,
non-empty string that conforms to the "symbolic-name" definition in the OSGi
core specification. This means that only the characters [-_.a-zA-Z0-9] may be
used. The length of the ID must not exceed 32 bytes when UTF-8 encoded.
| Modifier and Type | Field and Description |
|---|---|
private boolean |
booleanData |
private int |
cm |
static int |
CM_CC
Constant for identifying 'Cumulative Counter' data collection method.
|
static int |
CM_DER
Constant for identifying 'Discrete Event Registration' data collection
method.
|
static int |
CM_GAUGE
Constant for identifying 'Gauge' data collection method.
|
static int |
CM_SI
Constant for identifying 'Status Inspection' data collection method.
|
private float |
floatData |
private java.lang.String |
id |
private int |
intData |
(package private) static int |
MAX_ID_LENGTH |
private java.lang.String |
stringData |
(package private) static java.lang.String |
SYMBOLIC_NAME_CHARACTERS |
private java.util.Date |
timeStamp |
private int |
type |
static int |
TYPE_BOOLEAN
Constant for identifying
boolean data type. |
static int |
TYPE_FLOAT
Constant for identifying
float data type. |
static int |
TYPE_INTEGER
Constant for identifying
int data type. |
static int |
TYPE_STRING
Constant for identifying
String data type. |
| Constructor and Description |
|---|
StatusVariable(java.lang.String id,
int cm,
boolean data)
Constructor for a
StatusVariable of boolean type. |
StatusVariable(java.lang.String id,
int cm,
float data)
Constructor for a
StatusVariable of float type. |
StatusVariable(java.lang.String id,
int cm,
int data)
Constructor for a
StatusVariable of int type. |
StatusVariable(java.lang.String id,
int cm,
java.lang.String data)
Constructor for a
StatusVariable of String type. |
| Modifier and Type | Method and Description |
|---|---|
private static void |
checkId(java.lang.String id,
java.lang.String idName) |
private static boolean |
containsValidChars(java.lang.String name) |
boolean |
equals(java.lang.Object obj)
Compares the specified object with this
StatusVariable. |
private boolean |
equals(java.lang.Object o1,
java.lang.Object o2) |
boolean |
getBoolean()
Returns the
StatusVariable value if its type is boolean. |
int |
getCollectionMethod()
Returns the collection method of this
StatusVariable. |
float |
getFloat()
Returns the
StatusVariable value if its type is float. |
java.lang.String |
getID()
Returns the ID of this
StatusVariable. |
int |
getInteger()
Returns the
StatusVariable value if its type is int. |
java.lang.String |
getString()
Returns the
StatusVariable value if its type is String. |
java.util.Date |
getTimeStamp()
Returns the timestamp associated with the
StatusVariable. |
int |
getType()
Returns information on the data type of this
StatusVariable. |
int |
hashCode()
Returns the hash code value for this
StatusVariable. |
private int |
hashCode(java.lang.Object o) |
private void |
setCommon(java.lang.String id,
int cm) |
java.lang.String |
toString()
Returns a
String representation of this StatusVariable. |
public static final int TYPE_INTEGER
int data type.public static final int TYPE_FLOAT
float data type.public static final int TYPE_STRING
String data type.public static final int TYPE_BOOLEAN
boolean data type.public static final int CM_CC
public static final int CM_DER
public static final int CM_GAUGE
public static final int CM_SI
static final java.lang.String SYMBOLIC_NAME_CHARACTERS
static final int MAX_ID_LENGTH
private java.lang.String id
private java.util.Date timeStamp
private int cm
private int type
private int intData
private float floatData
private java.lang.String stringData
private boolean booleanData
public StatusVariable(java.lang.String id,
int cm,
int data)
StatusVariable of int type.id - the identifier of the StatusVariablecm - the collection method, one of the CM_ constantsdata - the int value of the StatusVariablejava.lang.IllegalArgumentException - if the given id is not
a valid StatusVariable name, or if cm is not one
of the collection method constantsjava.lang.NullPointerException - if the id parameter is
nullpublic StatusVariable(java.lang.String id,
int cm,
float data)
StatusVariable of float type.id - the identifier of the StatusVariablecm - the collection method, one of the CM_ constantsdata - the float value of the StatusVariablejava.lang.IllegalArgumentException - if the given id is not
a valid StatusVariable name, or if cm is not one
of the collection method constantsjava.lang.NullPointerException - if the id parameter is
nullpublic StatusVariable(java.lang.String id,
int cm,
boolean data)
StatusVariable of boolean type.id - the identifier of the StatusVariablecm - the collection method, one of the CM_ constantsdata - the boolean value of the StatusVariablejava.lang.IllegalArgumentException - if the given id is not
a valid StatusVariable name, or if cm is not one
of the collection method constantsjava.lang.NullPointerException - if the id parameter is
nullpublic StatusVariable(java.lang.String id,
int cm,
java.lang.String data)
StatusVariable of String type.id - the identifier of the StatusVariablecm - the collection method, one of the CM_ constantsdata - the String value of the StatusVariable, can
be nulljava.lang.IllegalArgumentException - if the given id is not
a valid StatusVariable name, or if cm is not one
of the collection method constantsjava.lang.NullPointerException - if the id parameter is
nullpublic java.lang.String getID()
StatusVariable. The ID is unique within
the scope of a Monitorable.StatusVariablepublic int getType()
StatusVariable.TYPE_ constants indicating the type of this
StatusVariablepublic java.util.Date getTimeStamp()
StatusVariable. The
timestamp is stored when the StatusVariable instance is created,
generally during the Monitorable.getStatusVariable(String) method
call.StatusVariable value was queried,
cannot be nullpublic java.lang.String getString()
throws java.lang.IllegalStateException
StatusVariable value if its type is String.StatusVariable value as a Stringjava.lang.IllegalStateException - if the type of the
StatusVariable is not Stringpublic int getInteger()
throws java.lang.IllegalStateException
StatusVariable value if its type is int.StatusVariable value as an intjava.lang.IllegalStateException - if the type of this
StatusVariable is not intpublic float getFloat()
throws java.lang.IllegalStateException
StatusVariable value if its type is float.StatusVariable value as a floatjava.lang.IllegalStateException - if the type of this
StatusVariable is not floatpublic boolean getBoolean()
throws java.lang.IllegalStateException
StatusVariable value if its type is boolean.StatusVariable value as a booleanjava.lang.IllegalStateException - if the type of this
StatusVariable is not booleanpublic int getCollectionMethod()
StatusVariable. See section
3.3 b) in [ETSI TS 132 403]CM_ constantspublic boolean equals(java.lang.Object obj)
StatusVariable. Two
StatusVariable objects are considered equal if their full path,
collection method and type are identical, and the data (selected by their
type) is equal.equals in class java.lang.Objectobj - the object to compare with this StatusVariabletrue if the argument represents the same
StatusVariable as this objectpublic int hashCode()
StatusVariable. The hash
code is calculated based on the full path, collection method and value of
the StatusVariable.hashCode in class java.lang.Objectpublic java.lang.String toString()
String representation of this StatusVariable.
The returned String contains the full path, collection method,
timestamp, type and value parameters of the StatusVariable in the
following format:
StatusVariable(<path>, <cm>, <timestamp>, <type>, <value>)The collection method identifiers used in the string representation are "CC", "DER", "GAUGE" and "SI" (without the quotes). The format of the timestamp is defined by the
Date.toString method, while the type
is identified by one of the strings "INTEGER", "FLOAT", "STRING" and
"BOOLEAN". The final field contains the string representation of the
value of the status variable.toString in class java.lang.ObjectString representation of this StatusVariableprivate void setCommon(java.lang.String id,
int cm)
throws java.lang.IllegalArgumentException,
java.lang.NullPointerException
java.lang.IllegalArgumentExceptionjava.lang.NullPointerExceptionprivate boolean equals(java.lang.Object o1,
java.lang.Object o2)
private int hashCode(java.lang.Object o)
private static void checkId(java.lang.String id,
java.lang.String idName)
throws java.lang.IllegalArgumentException,
java.lang.NullPointerException
java.lang.IllegalArgumentExceptionjava.lang.NullPointerExceptionprivate static boolean containsValidChars(java.lang.String name)