Package io.opencensus.tags
Class TagValue
- java.lang.Object
-
- io.opencensus.tags.TagValue
-
- Direct Known Subclasses:
AutoValue_TagValue
@Immutable public abstract class TagValue extends java.lang.ObjectA validated tag value.Validation ensures that the
Stringhas a maximum length ofMAX_LENGTHand contains only printable ASCII characters.- Since:
- 0.8
-
-
Field Summary
Fields Modifier and Type Field Description static intMAX_LENGTHThe maximum length for a tag value.
-
Constructor Summary
Constructors Constructor Description TagValue()
-
Method Summary
All Methods Static Methods Instance Methods Abstract Methods Concrete Methods Modifier and Type Method Description abstract java.lang.StringasString()Returns the tag value as aString.static TagValuecreate(java.lang.String value)Constructs aTagValuefrom the given string.private static booleanisValid(java.lang.String value)Determines whether the givenStringis a valid tag value.
-
-
-
Field Detail
-
MAX_LENGTH
public static final int MAX_LENGTH
The maximum length for a tag value. The value is 255.- Since:
- 0.8
- See Also:
- Constant Field Values
-
-
Method Detail
-
create
public static TagValue create(java.lang.String value)
Constructs aTagValuefrom 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:
java.lang.IllegalArgumentException- if theStringis not valid.- Since:
- 0.8
- It cannot be longer than
-
asString
public abstract java.lang.String asString()
Returns the tag value as aString.- Returns:
- the tag value as a
String. - Since:
- 0.8
-
isValid
private static boolean isValid(java.lang.String value)
Determines whether the givenStringis a valid tag value.- Parameters:
value- the tag value to be validated.- Returns:
- whether the value is valid.
-
-