Class AttributeParser


  • public class AttributeParser
    extends java.lang.Object
    This class contains functionality for parsing tags and attributes from string.
    • Method Summary

      All Methods Static Methods Concrete Methods 
      Modifier and Type Method Description
      static ItemAttributesRQ createItemAttribute​(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:attributeValue3
      static java.util.Set<ItemAttributesRQ> retrieveAttributes​(Attributes attributesAnnotation)
      Parse ReportPortal attributes from Attributes annotation instance.
      static ItemAttributesRQ splitKeyValue​(java.lang.String attribute)
      Parse a string representation of an attribute to ReportPortal attribute object instance.
      • Methods inherited from class java.lang.Object

        clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
    • 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:
        Set of ItemAttributesRQ
      • 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 from Attributes annotation 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 keys
        value - 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 key
        values - 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 key
        value - attribute value
        Returns:
        ReportPortal attribute