Class MetricNameTemplate


  • public class MetricNameTemplate
    extends java.lang.Object
    A template for a MetricName. It contains a name, group, and description, as well as all the tags that will be used to create the mBean name. Tag values are omitted from the template, but are filled in at runtime with their specified values. The order of the tags is maintained, if an ordered set is provided, so that the mBean names can be compared and sorted lexicographically.
    • Constructor Summary

      Constructors 
      Constructor Description
      MetricNameTemplate​(java.lang.String name, java.lang.String group, java.lang.String description, java.lang.String... tagsNames)
      Create a new template.
      MetricNameTemplate​(java.lang.String name, java.lang.String group, java.lang.String description, java.util.Set<java.lang.String> tagsNames)
      Create a new template.
    • Method Summary

      All Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      java.lang.String description()
      Get the description of the metric.
      boolean equals​(java.lang.Object o)  
      java.lang.String group()
      Get the name of the group.
      int hashCode()  
      java.lang.String name()
      Get the name of the metric.
      java.util.Set<java.lang.String> tags()
      Get the set of tag names for the metric.
      java.lang.String toString()  
      • Methods inherited from class java.lang.Object

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

      • MetricNameTemplate

        public MetricNameTemplate​(java.lang.String name,
                                  java.lang.String group,
                                  java.lang.String description,
                                  java.util.Set<java.lang.String> tagsNames)
        Create a new template. Note that the order of the tags will be preserved if the supplied tagsNames set has an order.
        Parameters:
        name - the name of the metric; may not be null
        group - the name of the group; may not be null
        description - the description of the metric; may not be null
        tagsNames - the set of metric tag names, which can/should be a set that maintains order; may not be null
      • MetricNameTemplate

        public MetricNameTemplate​(java.lang.String name,
                                  java.lang.String group,
                                  java.lang.String description,
                                  java.lang.String... tagsNames)
        Create a new template. Note that the order of the tags will be preserved.
        Parameters:
        name - the name of the metric; may not be null
        group - the name of the group; may not be null
        description - the description of the metric; may not be null
        tagsNames - the names of the metric tags in the preferred order; none of the tag names should be null
    • Method Detail

      • name

        public java.lang.String name()
        Get the name of the metric.
        Returns:
        the metric name; never null
      • group

        public java.lang.String group()
        Get the name of the group.
        Returns:
        the group name; never null
      • description

        public java.lang.String description()
        Get the description of the metric.
        Returns:
        the metric description; never null
      • tags

        public java.util.Set<java.lang.String> tags()
        Get the set of tag names for the metric.
        Returns:
        the ordered set of tag names; never null but possibly empty
      • hashCode

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

        public boolean equals​(java.lang.Object o)
        Overrides:
        equals in class java.lang.Object
      • toString

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