Class AttributeValue

java.lang.Object
io.opencensus.trace.AttributeValue
Direct Known Subclasses:
AttributeValue.AttributeValueBoolean, AttributeValue.AttributeValueDouble, AttributeValue.AttributeValueLong, AttributeValue.AttributeValueString

@Immutable public abstract class AttributeValue extends Object
A class that represents all the possible values for an attribute. An attribute can have 3 types of values: String, Boolean or Long.
Since:
0.5
  • Constructor Details

    • AttributeValue

      AttributeValue()
  • Method Details

    • stringAttributeValue

      public static AttributeValue stringAttributeValue(String stringValue)
      Returns an AttributeValue with a string value.
      Parameters:
      stringValue - The new value.
      Returns:
      an AttributeValue with a string value.
      Throws:
      NullPointerException - if stringValue is null.
      Since:
      0.5
    • booleanAttributeValue

      public static AttributeValue booleanAttributeValue(boolean booleanValue)
      Returns an AttributeValue with a boolean value.
      Parameters:
      booleanValue - The new value.
      Returns:
      an AttributeValue with a boolean value.
      Since:
      0.5
    • longAttributeValue

      public static AttributeValue longAttributeValue(long longValue)
      Returns an AttributeValue with a long value.
      Parameters:
      longValue - The new value.
      Returns:
      an AttributeValue with a long value.
      Since:
      0.5
    • doubleAttributeValue

      public static AttributeValue doubleAttributeValue(double doubleValue)
      Returns an AttributeValue with a double value.
      Parameters:
      doubleValue - The new value.
      Returns:
      an AttributeValue with a double value.
      Since:
      0.17
    • match

      @Deprecated public abstract <T> T match(Function<? super String,T> stringFunction, Function<? super Boolean,T> booleanFunction, Function<? super Long,T> longFunction, Function<Object,T> defaultFunction)
      Applies a function to the underlying value. The function that is called depends on the value's type, which can be String, Long, or Boolean.
      Parameters:
      stringFunction - the function that should be applied if the value has type String.
      booleanFunction - the function that should be applied if the value has type Boolean.
      longFunction - the function that should be applied if the value has type Long.
      defaultFunction - the function that should be applied if the value has a type that was added after this match method was added to the API. See Functions for some common functions for handling unknown types.
      Returns:
      the result of the function applied to the underlying value.
      Since:
      0.5
    • match

      public abstract <T> T match(Function<? super String,T> stringFunction, Function<? super Boolean,T> booleanFunction, Function<? super Long,T> longFunction, Function<? super Double,T> doubleFunction, Function<Object,T> defaultFunction)
      Applies a function to the underlying value. The function that is called depends on the value's type, which can be String, Long, or Boolean.
      Parameters:
      stringFunction - the function that should be applied if the value has type String.
      booleanFunction - the function that should be applied if the value has type Boolean.
      longFunction - the function that should be applied if the value has type Long.
      doubleFunction - the function that should be applied if the value has type Double.
      defaultFunction - the function that should be applied if the value has a type that was added after this match method was added to the API. See Functions for some common functions for handling unknown types.
      Returns:
      the result of the function applied to the underlying value.
      Since:
      0.17