Package io.opencensus.trace
Class AttributeValue
java.lang.Object
io.opencensus.trace.AttributeValue
- Direct Known Subclasses:
AttributeValue.AttributeValueBoolean
,AttributeValue.AttributeValueDouble
,AttributeValue.AttributeValueLong
,AttributeValue.AttributeValueString
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
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescription(package private) static class
(package private) static class
(package private) static class
(package private) static class
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionstatic AttributeValue
booleanAttributeValue
(boolean booleanValue) Returns anAttributeValue
with a boolean value.static AttributeValue
doubleAttributeValue
(double doubleValue) Returns anAttributeValue
with a double value.static AttributeValue
longAttributeValue
(long longValue) Returns anAttributeValue
with a long value.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.abstract <T> T
match
(Function<? super String, T> stringFunction, Function<? super Boolean, T> booleanFunction, Function<? super Long, T> longFunction, Function<Object, T> defaultFunction) Deprecated.static AttributeValue
stringAttributeValue
(String stringValue) Returns anAttributeValue
with a string value.
-
Constructor Details
-
AttributeValue
AttributeValue()
-
-
Method Details
-
stringAttributeValue
Returns anAttributeValue
with a string value.- Parameters:
stringValue
- The new value.- Returns:
- an
AttributeValue
with a string value. - Throws:
NullPointerException
- ifstringValue
isnull
.- Since:
- 0.5
-
booleanAttributeValue
Returns anAttributeValue
with a boolean value.- Parameters:
booleanValue
- The new value.- Returns:
- an
AttributeValue
with a boolean value. - Since:
- 0.5
-
longAttributeValue
Returns anAttributeValue
with a long value.- Parameters:
longValue
- The new value.- Returns:
- an
AttributeValue
with a long value. - Since:
- 0.5
-
doubleAttributeValue
Returns anAttributeValue
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) 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
.booleanFunction
- the function that should be applied if the value has typeBoolean
.longFunction
- the function that should be applied if the value has typeLong
.defaultFunction
- the function that should be applied if the value has a type that was added after thismatch
method was added to the API. SeeFunctions
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 beString
,Long
, orBoolean
.- Parameters:
stringFunction
- the function that should be applied if the value has typeString
.booleanFunction
- the function that should be applied if the value has typeBoolean
.longFunction
- the function that should be applied if the value has typeLong
.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 thismatch
method was added to the API. SeeFunctions
for some common functions for handling unknown types.- Returns:
- the result of the function applied to the underlying value.
- Since:
- 0.17
-
match(Function, Function, Function, Function, Function)
.