Class StatusVariable


  • public final class StatusVariable
    extends java.lang.Object
    A 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.

    • Field Summary

      Fields 
      Modifier and Type Field Description
      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.
      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 Summary

      Constructors 
      Constructor 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.
    • Method Summary

      All Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      boolean equals​(java.lang.Object obj)
      Compares the specified object with this StatusVariable.
      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.
      java.lang.String toString()
      Returns a String representation of this StatusVariable.
      • Methods inherited from class java.lang.Object

        clone, finalize, getClass, notify, notifyAll, wait, wait, wait
    • Field Detail

      • TYPE_INTEGER

        public static final int TYPE_INTEGER
        Constant for identifying int data type.
        See Also:
        Constant Field Values
      • TYPE_FLOAT

        public static final int TYPE_FLOAT
        Constant for identifying float data type.
        See Also:
        Constant Field Values
      • TYPE_STRING

        public static final int TYPE_STRING
        Constant for identifying String data type.
        See Also:
        Constant Field Values
      • TYPE_BOOLEAN

        public static final int TYPE_BOOLEAN
        Constant for identifying boolean data type.
        See Also:
        Constant Field Values
      • CM_CC

        public static final int CM_CC
        Constant for identifying 'Cumulative Counter' data collection method.
        See Also:
        Constant Field Values
      • CM_DER

        public static final int CM_DER
        Constant for identifying 'Discrete Event Registration' data collection method.
        See Also:
        Constant Field Values
      • CM_GAUGE

        public static final int CM_GAUGE
        Constant for identifying 'Gauge' data collection method.
        See Also:
        Constant Field Values
      • CM_SI

        public static final int CM_SI
        Constant for identifying 'Status Inspection' data collection method.
        See Also:
        Constant Field Values
    • Constructor Detail

      • StatusVariable

        public StatusVariable​(java.lang.String id,
                              int cm,
                              int data)
        Constructor for a StatusVariable of int type.
        Parameters:
        id - the identifier of the StatusVariable
        cm - the collection method, one of the CM_ constants
        data - the int value of the StatusVariable
        Throws:
        java.lang.IllegalArgumentException - if the given id is not a valid StatusVariable name, or if cm is not one of the collection method constants
        java.lang.NullPointerException - if the id parameter is null
      • StatusVariable

        public StatusVariable​(java.lang.String id,
                              int cm,
                              float data)
        Constructor for a StatusVariable of float type.
        Parameters:
        id - the identifier of the StatusVariable
        cm - the collection method, one of the CM_ constants
        data - the float value of the StatusVariable
        Throws:
        java.lang.IllegalArgumentException - if the given id is not a valid StatusVariable name, or if cm is not one of the collection method constants
        java.lang.NullPointerException - if the id parameter is null
      • StatusVariable

        public StatusVariable​(java.lang.String id,
                              int cm,
                              boolean data)
        Constructor for a StatusVariable of boolean type.
        Parameters:
        id - the identifier of the StatusVariable
        cm - the collection method, one of the CM_ constants
        data - the boolean value of the StatusVariable
        Throws:
        java.lang.IllegalArgumentException - if the given id is not a valid StatusVariable name, or if cm is not one of the collection method constants
        java.lang.NullPointerException - if the id parameter is