Class Metric


  • @Immutable
    public class Metric
    extends java.lang.Object
    Helper class to model a metric.
    Author:
    trygve, gjoranv
    • Field Summary

      Fields 
      Modifier and Type Field Description
      java.lang.String description  
      java.util.Map<java.lang.String,​java.lang.String> dimensions  
      java.lang.String name  
      java.lang.String outputName  
    • Constructor Summary

      Constructors 
      Constructor Description
      Metric​(java.lang.String name)
      Creates a metric with same outputname as metricname
      Metric​(java.lang.String name, java.lang.String outputName)
      Creates a metric with empty description
      Metric​(java.lang.String name, java.lang.String outputName, java.lang.String description)  
      Metric​(java.lang.String name, java.lang.String outputName, java.lang.String description, java.util.Map<java.lang.String,​java.lang.String> dimensions)  
    • Method Summary

      All Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      Metric addDimensionsFrom​(Metric other)
      Returns a new Metric that is a combination of this and the given metric.
      boolean equals​(java.lang.Object o)
      Two metrics are considered equal if they have the same name.
      int hashCode()  
      java.lang.String toString()  
      • Methods inherited from class java.lang.Object

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

      • name

        public final java.lang.String name
      • outputName

        public final java.lang.String outputName
      • description

        public final java.lang.String description
      • dimensions

        public final java.util.Map<java.lang.String,​java.lang.String> dimensions
    • Constructor Detail

      • Metric

        public Metric​(java.lang.String name,
                      java.lang.String outputName,
                      java.lang.String description,
                      java.util.Map<java.lang.String,​java.lang.String> dimensions)
      • Metric

        public Metric​(java.lang.String name,
                      java.lang.String outputName,
                      java.lang.String description)
      • Metric

        public Metric​(java.lang.String name,
                      java.lang.String outputName)
        Creates a metric with empty description
      • Metric

        public Metric​(java.lang.String name)
        Creates a metric with same outputname as metricname
        Parameters:
        name - The name of the metric, same name used for output name
    • Method Detail

      • addDimensionsFrom

        public Metric addDimensionsFrom​(Metric other)
        Returns a new Metric that is a combination of this and the given metric. New dimensions from the given metric are added, but already existing dimensions will be kept unchanged.
        Parameters:
        other - The metric to add dimensions from.
        Returns:
        A new metric with dimensions from this and the other.
      • toString

        public java.lang.String toString()
        Overrides:
        toString in class java.lang.Object
      • equals

        public boolean equals​(java.lang.Object o)
        Two metrics are considered equal if they have the same name.
        Overrides:
        equals in class java.lang.Object
      • hashCode

        public int hashCode()
        Overrides:
        hashCode in class java.lang.Object