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 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 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> Tmatch(Function<? super String, T> stringFunction, Function<? super Boolean, T> booleanFunction, Function<? super Long, T> longFunction, Function<Object, T> defaultFunction) Deprecated.static AttributeValuestringAttributeValue(String stringValue) Returns anAttributeValuewith a string value.
-
Constructor Details
-
AttributeValue
AttributeValue()
-
-
Method Details
-
stringAttributeValue
Returns anAttributeValuewith a string value.- Parameters:
stringValue- The new value.- Returns:
- an
AttributeValuewith a string value. - Throws:
NullPointerException- ifstringValueisnull.- Since:
- 0.5
-
booleanAttributeValue
Returns anAttributeValuewith a boolean value.- Parameters:
booleanValue- The new value.- Returns:
- an
AttributeValuewith a boolean value. - Since:
- 0.5
-
longAttributeValue
Returns anAttributeValuewith a long value.- Parameters:
longValue- The new value.- Returns:
- an
AttributeValuewith a long value. - Since:
- 0.5
-
doubleAttributeValue
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 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 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 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 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
-
match(Function, Function, Function, Function, Function).