Package com.newrelic.telemetry
Class Attributes
- java.lang.Object
-
- com.newrelic.telemetry.Attributes
-
public class Attributes extends java.lang.ObjectA collection of key-value pairs that can be used as the dimensional attributes for metrics.Only String keys are allowed. Acceptable values for attributes include Numbers, Strings, and booleans.
-
-
Constructor Summary
Constructors Constructor Description Attributes()Creates an empty objectAttributes(Attributes original)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description java.util.Map<java.lang.String,java.lang.Object>asMap()Make a copy of these attributes.Attributescopy()Creates a copy.booleanequals(java.lang.Object o)inthashCode()booleanisEmpty()Attributesput(java.lang.String key, boolean value)Add a boolean-valued attribute.Attributesput(java.lang.String key, java.lang.Number value)Add a Number-valued attribute.Attributesput(java.lang.String key, java.lang.String value)Add a string-valued attribute.AttributesputAll(Attributes incoming)Merge attributes into current attributesjava.lang.StringtoString()
-
-
-
Constructor Detail
-
Attributes
public Attributes()
Creates an empty object
-
Attributes
public Attributes(Attributes original)
- Parameters:
original- Creates a copy. Changes to the new copy will not affect the original and vice versa.
-
-
Method Detail
-
copy
public Attributes copy()
Creates a copy. Changes to the new copy will not affect the original and vice versa.- Returns:
- new instance holding current attributes
-
putAll
public Attributes putAll(Attributes incoming)
Merge attributes into current attributes- Parameters:
incoming- attributes to be merged- Returns:
- this
-
put
public Attributes put(java.lang.String key, java.lang.String value)
Add a string-valued attribute.- Parameters:
key- to locate the valuevalue- to be stored- Returns:
- this
-
put
public Attributes put(java.lang.String key, java.lang.Number value)
Add a Number-valued attribute.- Parameters:
key- to locate the valuevalue- to be stored- Returns:
- this
-
put
public Attributes put(java.lang.String key, boolean value)
Add a boolean-valued attribute.- Parameters:
key- to locate the valuevalue- to be stored- Returns:
- this
-
asMap
public java.util.Map<java.lang.String,java.lang.Object> asMap()
Make a copy of these attributes.- Returns:
- An unmodifiable copy of these attributes, as a Map.
-
isEmpty
public boolean isEmpty()
- Returns:
- true if there are no attributes in this Attributes instance
-
equals
public boolean equals(java.lang.Object o)
- Overrides:
equalsin classjava.lang.Object
-
hashCode
public int hashCode()
- Overrides:
hashCodein classjava.lang.Object
-
toString
public java.lang.String toString()
- Overrides:
toStringin classjava.lang.Object
-
-