Class AnyValue
- java.lang.Object
-
- io.opentelemetry.sdk.logging.data.AnyValue
-
@Immutable public abstract class AnyValue extends Object
A class that represents all the possible values for a data body. AnAnyValue
can have 6 types of values:String
,boolean
,int
,double
,array
, orkvlist
. represented throughAnyValue.Type
. Aarray
or akvlist
can in turn hold otherAnyValue
instances, allowing for mapping to JSON-like structures.
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description static class
AnyValue.Type
An enum that represents all the possible value types for anAnyValue
.
-
Constructor Summary
Constructors Constructor Description AnyValue()
-
Method Summary
All Methods Static Methods Instance Methods Abstract Methods Concrete Methods Modifier and Type Method Description static AnyValue
arrayAnyValue(List<AnyValue> values)
Returns anAnyValue
with a array value.static AnyValue
boolAnyValue(boolean boolValue)
Returns anAnyValue
with a bool value.static AnyValue
doubleAnyValue(double doubleValue)
Returns anAnyValue
with a double value.List<AnyValue>
getArrayValue()
Returns the array value of thisAnyValue
.boolean
getBoolValue()
Returns the boolean value of thisAnyValue
.double
getDoubleValue()
Returns the double value of thisAnyValue
.Map<String,AnyValue>
getKvlistValue()
Returns the string value of thisAnyValue
.long
getLongValue()
String
getStringValue()
Returns the string value of thisAnyValue
.abstract AnyValue.Type
getType()
static AnyValue
kvlistAnyValue(Map<String,AnyValue> values)
Returns anAnyValue
with a kvlist value.static AnyValue
longAnyValue(long longValue)
Returns anAnyValue
with an int value.static AnyValue
stringAnyValue(String stringValue)
Returns anAnyValue
with a string value.
-
-
-
Method Detail
-
stringAnyValue
public static AnyValue stringAnyValue(String stringValue)
Returns anAnyValue
with a string value.- Parameters:
stringValue
- The new value.- Returns:
- an
AnyValue
with a string value.
-
getStringValue
public String getStringValue()
Returns the string value of thisAnyValue
. An UnsupportedOperationException will be thrown if getType() is notAnyValue.Type.STRING
.- Returns:
- the string value of this
AttributeValue
.
-
longAnyValue
public static AnyValue longAnyValue(long longValue)
Returns anAnyValue
with an int value.- Parameters:
longValue
- The new value.- Returns:
- an
AnyValue
with a int value.
-
getLongValue
public long getLongValue()
-
boolAnyValue
public static AnyValue boolAnyValue(boolean boolValue)
Returns anAnyValue
with a bool value.- Parameters:
boolValue
- The new value.- Returns:
- an
AnyValue
with a bool value.
-
getBoolValue
public boolean getBoolValue()
Returns the boolean value of thisAnyValue
. An UnsupportedOperationException will be thrown if getType() is notAnyValue.Type.BOOL
.- Returns:
- the boolean value of this
AttributeValue
.
-
doubleAnyValue
public static AnyValue doubleAnyValue(double doubleValue)
Returns anAnyValue
with a double value.- Parameters:
doubleValue
- The new value.- Returns:
- an
AnyValue
with a double value.
-
getDoubleValue
public double getDoubleValue()
Returns the double value of thisAnyValue
. An UnsupportedOperationException will be thrown if getType() is notAnyValue.Type.DOUBLE
.- Returns:
- the double value of this
AttributeValue
.
-
arrayAnyValue
public static AnyValue arrayAnyValue(List<AnyValue> values)
Returns anAnyValue
with a array value.- Parameters:
values
- The new value.- Returns:
- an
AnyValue
with a array value.
-
getArrayValue
public List<AnyValue> getArrayValue()
Returns the array value of thisAnyValue
. An UnsupportedOperationException will be thrown if getType() is notAnyValue.Type.ARRAY
.- Returns:
- the array value of this
AttributeValue
.
-
kvlistAnyValue
public static AnyValue kvlistAnyValue(Map<String,AnyValue> values)
Returns anAnyValue
with a kvlist value.- Parameters:
values
- The new value.- Returns:
- an
AnyValue
with a kvlist value.
-
getKvlistValue
public Map<String,AnyValue> getKvlistValue()
Returns the string value of thisAnyValue
. An UnsupportedOperationException will be thrown if getType() is notAnyValue.Type.STRING
.- Returns:
- the string value of this
AttributeValue
.
-
getType
public abstract AnyValue.Type getType()
-
-