Package com.epam.reportportal.utils
Class AttributeParser
- java.lang.Object
-
- com.epam.reportportal.utils.AttributeParser
-
public class AttributeParser extends java.lang.ObjectThis class contains functionality for parsing tags and attributes from string.
-
-
Field Summary
Fields Modifier and Type Field Description static java.lang.StringATTRIBUTES_SPLITTERstatic java.lang.StringKEY_VALUE_SPLITTER
-
Method Summary
All Methods Static Methods Concrete Methods Modifier and Type Method Description static ItemAttributesRQcreateItemAttribute(java.lang.String key, java.lang.String value)Create an ItemAttributesRQ instance with key and value.static java.util.List<ItemAttributesRQ>createItemAttributes(java.lang.String[] keys, java.lang.String value)Create list of attributes from key array and a value.static java.util.List<ItemAttributesRQ>createItemAttributes(java.lang.String key, java.lang.String[] values)Create list of attributes from a key and value array.static java.util.Set<ItemAttributesRQ>parseAsSet(java.lang.String rawAttributes)Parse attribute string.
Input attribute string should have format: build:4r3wf234;attributeKey:attributeValue;attributeValue2;attributeValue3.
Output map should have format:
build:4r3wf234
attributeKey:attributeValue
null:attributeValue2
null:attributeValue3static java.util.Set<ItemAttributesRQ>retrieveAttributes(Attributes attributesAnnotation)Parse ReportPortal attributes fromAttributesannotation instance.static ItemAttributesRQsplitKeyValue(java.lang.String attribute)Parse a string representation of an attribute to ReportPortal attribute object instance.
-
-
-
Field Detail
-
ATTRIBUTES_SPLITTER
public static final java.lang.String ATTRIBUTES_SPLITTER
- See Also:
- Constant Field Values
-
KEY_VALUE_SPLITTER
public static final java.lang.String KEY_VALUE_SPLITTER
- See Also:
- Constant Field Values
-
-
Method Detail
-
parseAsSet
@Nonnull public static java.util.Set<ItemAttributesRQ> parseAsSet(@Nullable java.lang.String rawAttributes)
Parse attribute string.
Input attribute string should have format: build:4r3wf234;attributeKey:attributeValue;attributeValue2;attributeValue3.
Output map should have format:
build:4r3wf234
attributeKey:attributeValue
null:attributeValue2
null:attributeValue3- Parameters:
rawAttributes- Attributes string- Returns:
SetofItemAttributesRQ
-
splitKeyValue
@Nullable public static ItemAttributesRQ splitKeyValue(@Nullable java.lang.String attribute)
Parse a string representation of an attribute to ReportPortal attribute object instance. E.G.: 'key:value', ' :value', 'tag'- Parameters:
attribute- string representation of an attribute- Returns:
- ReportPortal attribute object instance
-
retrieveAttributes
@Nonnull public static java.util.Set<ItemAttributesRQ> retrieveAttributes(@Nonnull Attributes attributesAnnotation)
Parse ReportPortal attributes fromAttributesannotation instance.- Parameters:
attributesAnnotation- annotation instance- Returns:
- a set of ReportPortal attributes
-
createItemAttributes
@Nonnull public static java.util.List<ItemAttributesRQ> createItemAttributes(@Nullable java.lang.String[] keys, @Nullable java.lang.String value)
Create list of attributes from key array and a value.- Parameters:
keys- attribute keysvalue- attribute value- Returns:
- list of ReportPortal attributes
-
createItemAttributes
@Nonnull public static java.util.List<ItemAttributesRQ> createItemAttributes(@Nullable java.lang.String key, @Nullable java.lang.String[] values)
Create list of attributes from a key and value array.- Parameters:
key- attribute keyvalues- attribute values- Returns:
- list of ReportPortal attributes
-
createItemAttribute
@Nonnull public static ItemAttributesRQ createItemAttribute(@Nullable java.lang.String key, @Nonnull java.lang.String value)
Create an ItemAttributesRQ instance with key and value.- Parameters:
key- attribute keyvalue- attribute value- Returns:
- ReportPortal attribute
-
-