Package io.opencensus.tags
Class TagValue
java.lang.Object
io.opencensus.tags.TagValue
- Direct Known Subclasses:
AutoValue_TagValue
A validated tag value.
Validation ensures that the String
has a maximum length of MAX_LENGTH
and
contains only printable ASCII characters.
- Since:
- 0.8
-
Field Summary
Fields -
Constructor Summary
Constructors -
Method Summary
-
Field Details
-
MAX_LENGTH
public static final int MAX_LENGTHThe maximum length for a tag value. The value is 255.- Since:
- 0.8
- See Also:
-
-
Constructor Details
-
TagValue
TagValue()
-
-
Method Details
-
create
Constructs aTagValue
from the given string. The string must meet the following requirements:- It cannot be longer than
MAX_LENGTH
. - It can only contain printable ASCII characters.
- Parameters:
value
- the tag value.- Throws:
IllegalArgumentException
- if theString
is not valid.- Since:
- 0.8
- It cannot be longer than
-
asString
Returns the tag value as aString
.- Returns:
- the tag value as a
String
. - Since:
- 0.8
-
isValid
Determines whether the givenString
is a valid tag value.- Parameters:
value
- the tag value to be validated.- Returns:
- whether the value is valid.
-