com.yammer.metrics.core
Class MetricName

java.lang.Object
  extended by com.yammer.metrics.core.MetricName
All Implemented Interfaces:
Comparable<MetricName>

public class MetricName
extends Object
implements Comparable<MetricName>

A value class encapsulating a metric's owning class and name.


Constructor Summary
MetricName(Class<?> klass, String name)
          Creates a new MetricName without a scope.
MetricName(Class<?> klass, String name, String scope)
          Creates a new MetricName without a scope.
MetricName(String group, String type, String name)
          Creates a new MetricName without a scope.
MetricName(String group, String type, String name, String scope)
          Creates a new MetricName without a scope.
MetricName(String group, String type, String name, String scope, String mbeanName)
          Creates a new MetricName without a scope.
 
Method Summary
 int compareTo(MetricName o)
           
 boolean equals(Object o)
           
 String getGroup()
          Returns the group to which the Metric belongs.
 String getMBeanName()
          Returns the mbean name for the Metric identified by this metric name.
 String getName()
          Returns the name of the Metric.
 String getScope()
          Returns the scope of the Metric.
 String getType()
          Returns the type to which the Metric belongs.
 int hashCode()
           
 boolean hasScope()
          Returns true if the Metric has a scope, false otherwise.
 String toString()
           
 
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
 

Constructor Detail

MetricName

public MetricName(Class<?> klass,
                  String name)
Creates a new MetricName without a scope.

Parameters:
klass - the Class to which the Metric belongs
name - the name of the Metric

MetricName

public MetricName(String group,
                  String type,
                  String name)
Creates a new MetricName without a scope.

Parameters:
group - the group to which the Metric belongs
type - the type to which the Metric belongs
name - the name of the Metric

MetricName

public MetricName(Class<?> klass,
                  String name,
                  String scope)
Creates a new MetricName without a scope.

Parameters:
klass - the Class to which the Metric belongs
name - the name of the Metric
scope - the scope of the Metric

MetricName

public MetricName(String group,
                  String type,
                  String name,
                  String scope)
Creates a new MetricName without a scope.

Parameters:
group - the group to which the Metric belongs
type - the type to which the Metric belongs
name - the name of the Metric
scope - the scope of the Metric

MetricName

public MetricName(String group,
                  String type,
                  String name,
                  String scope,
                  String mbeanName)
Creates a new MetricName without a scope.

Parameters:
group - the group to which the Metric belongs
type - the type to which the Metric belongs
name - the name of the Metric
scope - the scope of the Metric
mbeanName - the 'ObjectName', represented as a string, to use when registering the mbean.
Method Detail

getGroup

public String getGroup()
Returns the group to which the Metric belongs. For class-based metrics, this will be the package name of the Class to which the Metric belongs.

Returns:
the group to which the Metric belongs

getType

public String getType()
Returns the type to which the Metric belongs. For class-based metrics, this will be the simple class name of the Class to which the Metric belongs.

Returns:
the type to which the Metric belongs

getName

public String getName()
Returns the name of the Metric.

Returns:
the name of the Metric

getScope

public String getScope()
Returns the scope of the Metric.

Returns:
the scope of the Metric

hasScope

public boolean hasScope()
Returns true if the Metric has a scope, false otherwise.

Returns:
true if the Metric has a scope

getMBeanName

public String getMBeanName()
Returns the mbean name for the Metric identified by this metric name.

Returns:
the mbean name

equals

public boolean equals(Object o)
Overrides:
equals in class Object

hashCode

public int hashCode()
Overrides:
hashCode in class Object

toString

public String toString()
Overrides:
toString in class Object

compareTo

public int compareTo(MetricName o)
Specified by:
compareTo in interface Comparable<MetricName>


Copyright © 2011. All Rights Reserved.