Class Attributes


  • public class Attributes
    extends java.lang.Object
    A 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.

    • 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.
      Attributes copy()
      Creates a copy.
      boolean equals​(java.lang.Object o)  
      int hashCode()  
      boolean isEmpty()  
      Attributes put​(java.lang.String key, boolean value)
      Add a boolean-valued attribute.
      Attributes put​(java.lang.String key, java.lang.Number value)
      Add a Number-valued attribute.
      Attributes put​(java.lang.String key, java.lang.String value)
      Add a string-valued attribute.
      Attributes putAll​(Attributes incoming)
      Merge attributes into current attributes
      java.lang.String toString()  
      • Methods inherited from class java.lang.Object

        clone, finalize, getClass, notify, notifyAll, wait, wait, wait
    • 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 value
        value - 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 value
        value - 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 value
        value - 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:
        equals in class java.lang.Object
      • hashCode

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

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