Class JabbixMetric<T>

  • Type Parameters:
    T - the type of the metric value
    Direct Known Subclasses:
    JabbixActiveMetric

    public class JabbixMetric<T>
    extends java.lang.Object
    A metric, the named value representing certain parameter of a system.
    Author:
    Paul Wolneykien
    • Constructor Summary

      Constructors 
      Constructor Description
      JabbixMetric​(java.lang.String key, java.lang.Class<T> type, T value)
      Constructs a new metric with the specified name and value type.
    • Method Summary

      All Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      boolean equals​(java.lang.Object o)
      Indicates whether some other object is "equal to" the metric.
      java.lang.String getKey()
      Returns the name of the metric.
      T getValue()
      Returns the value of the metric.
      java.lang.Class<T> getValueType()
      Returns a class for the value type of the metric.
      java.lang.String toString()
      Returns the textual string representation of the value.
      void updateValue​(java.lang.Object value)
      Updates the value of the metric.
      • Methods inherited from class java.lang.Object

        getClass, hashCode, notify, notifyAll, wait, wait, wait
    • Constructor Detail

      • JabbixMetric

        public JabbixMetric​(java.lang.String key,
                            java.lang.Class<T> type,
                            T value)
        Constructs a new metric with the specified name and value type.
        Parameters:
        key - the name of the metric
        value - the value of the metric
    • Method Detail

      • getKey

        public java.lang.String getKey()
        Returns the name of the metric.
        Returns:
        the name of the metric
      • getValue

        public T getValue()
        Returns the value of the metric.
        Returns:
        the value of the metric
      • updateValue

        public void updateValue​(java.lang.Object value)
                         throws java.lang.ClassCastException
        Updates the value of the metric.
        Parameters:
        value - the new value
        Throws:
        java.lang.ClassCastException - if type of the new value is incompatible with the value type of the metric
        See Also:
        MetricTable.updateMetric(JabbixMetric)
      • toString

        public java.lang.String toString()
        Returns the textual string representation of the value. A special "null" value is returned in the case when the metric value is null.
        Overrides:
        toString in class java.lang.Object
      • equals

        public boolean equals​(java.lang.Object o)
        Indicates whether some other object is "equal to" the metric. Two metrics are equal iff their keys are equal. A metric isn't equal to an object not derived from JabbixMetric.
        Overrides:
        equals in class java.lang.Object
      • getValueType

        public java.lang.Class<T> getValueType()
        Returns a class for the value type of the metric.
        Returns:
        a class for the value type of the metric