Package io.opencensus.trace
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 java.lang.ObjectA class that represents all the possible values for an attribute. An attribute can have 3 types of values:String,BooleanorLong.- Since:
- 0.5
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description (package private) static classAttributeValue.AttributeValueBoolean(package private) static classAttributeValue.AttributeValueDouble(package private) static classAttributeValue.AttributeValueLong(package private) static classAttributeValue.AttributeValueString
-
Constructor Summary
Constructors Constructor Description AttributeValue()
-
Method Summary
All Methods Static Methods Instance Methods Abstract Methods Concrete Methods Deprecated Methods Modifier and Type Method Description static AttributeValuebooleanAttributeValue(boolean booleanValue)Returns anAttributeValuewith a boolean value.static AttributeValuedoubleAttributeValue(double doubleValue)Returns anAttributeValuewith a double value.static AttributeValuelongAttributeValue(long longValue)Returns anAttributeValuewith a long value.abstract <T> Tmatch(Function<? super java.lang.String,T> stringFunction, Function<? super java.lang.Boolean,T> booleanFunction, Function<? super java.lang.Long,T> longFunction, Function<? super java.lang.Double,T> doubleFunction, Function<java.lang.Object,T> defaultFunction)Applies a function to the underlying value.abstract <T> Tmatch(Function<? super java.lang.String,T> stringFunction, Function<? super java.lang.Boolean,T> booleanFunction, Function<? super java.lang.Long,T> longFunction, Function<java.lang.Object,T> defaultFunction)Deprecated.static AttributeValuestringAttributeValue(java.lang.String stringValue)Returns anAttributeValuewith a string value.
-
-
-
Method Detail
-
stringAttributeValue
public static AttributeValue stringAttributeValue(java.lang.String stringValue)
Returns anAttributeValuewith a string value.- Parameters:
stringValue- The new value.- Returns:
- an
AttributeValuewith a string value. - Throws:
java.lang.NullPointerException- ifstringValueisnull.- Since:
- 0.5
-
booleanAttributeValue
public static AttributeValue booleanAttributeValue(boolean booleanValue)
Returns anAttributeValuewith a boolean value.- Parameters:
booleanValue- The new value.- Returns:
- an
AttributeValuewith a boolean value. - Since:
- 0.5
-
longAttributeValue
public static AttributeValue longAttributeValue(long longValue)
Returns anAttributeValuewith a long value.- Parameters:
longValue- The new value.- Returns:
- an
AttributeValuewith a long value. - Since:
- 0.5
-
doubleAttributeValue
public static AttributeValue doubleAttributeValue(double doubleValue)
Returns anAttributeValuewith a double value.- Parameters:
doubleValue- The new value.- Returns:
- an
AttributeValuewith a double value. - Since:
- 0.17
-
match
@Deprecated public abstract <T> T match(Function<? super java.lang.String,T> stringFunction, Function<? super java.lang.Boolean,T> booleanFunction, Function<? super java.lang.Long,T> longFunction, Function<java.lang.Object,T> defaultFunction)
Deprecated.Applies a function to the underlying value. The function that is called depends on the value's type, which can beString,Long, orBoolean.- Parameters:
stringFunction- the function that should be applied if the value has typeString.longFunction- the function that should be applied if the value has typeLong.booleanFunction- the function that should be applied if the value has typeBoolean.defaultFunction- the function that should be applied if the value has a type that was added after thismatchmethod was added to the API. SeeFunctionsfor 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 java.lang.String,T> stringFunction, Function<? super java.lang.Boolean,T> booleanFunction, Function<? super java.lang.Long,T> longFunction, Function<? super java.lang.Double,T> doubleFunction, Function<java.lang.Object,T> defaultFunction)
Applies a function to the underlying value. The function that is called depends on the value's type, which can beString,Long, orBoolean.- Parameters:
stringFunction- the function that should be applied if the value has typeString.longFunction- the function that should be applied if the value has typeLong.booleanFunction- the function that should be applied if the value has typeBoolean.doubleFunction- the function that should be applied if the value has typeDouble.defaultFunction- the function that should be applied if the value has a type that was added after thismatchmethod was added to the API. SeeFunctionsfor some common functions for handling unknown types.- Returns:
- the result of the function applied to the underlying value.
- Since:
- 0.17
-
-