Class Attributes

Object
com.tailf.progress.Attributes

public class Attributes extends Object

Attributes class is used to create, and manipulate progress trace attributes. Attributes can be used when creating a new event or span.

  • Constructor Details

    • Attributes

      public Attributes()
      Instantiate an empty attribute object
    • Attributes

      public Attributes(String name, String value)
      Instantiate an attribute object
      Parameters:
      name - the name of the attribute
      value - the value of the attribute
  • Method Details

    • set

      public void set(String name, String value)
      Set an attribute name and value
      Parameters:
      name - the name of the attribute
      value - the value of the attribute
    • getValue

      public String getValue(String name)
      Get an attribute's value
      Parameters:
      name - the atrribute's name
      Returns:
      the value as String. This can return null if the value is not found.
    • contains

      public boolean contains(String name)
      Check if attribute exists by its name
      Parameters:
      name - the atrribute's name
    • toMap

      public HashMap<String,String> toMap()
      Convert the current attributes to HashMap format
      Returns:
      attributes in HashMap
    • fromMap

      public static Attributes fromMap(HashMap<String,String> map)
      Build attributes from a HashMap
      Parameters:
      map - attributes in HashMap
      Returns:
      Attributes object
    • merge

      public Attributes merge(Attributes otherAttrs)
      Merge 2 attribute objects
      Parameters:
      otherAttrs - other attributes
      Returns:
      a new Attributes object
    • clear

      public void clear()
      Clear all existng attributes