Class AttributeParser


  • public class AttributeParser
    extends java.lang.Object
    This class contains functionality for parsing tags and attributes from string.
    • 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​(@Nullable
                                                                         Attributes attributesAnnotation)
        Parse ReportPortal attributes from Attributes annotation instance.
        Parameters:
        attributesAnnotation - annotation instance
        Returns:
        a set of ReportPortal attributes
      • retrieveAttributes

        @Nonnull
        public static java.util.Set<ItemAttributesRQ> retrieveAttributes​(@Nullable
                                                                         Attribute... attributes)
        Parse ReportPortal attributes from Attribute annotations.
        Parameters:
        attributes - annotation instances
        Returns:
        a set of ReportPortal attributes
      • retrieveAttributes

        @Nonnull
        public static java.util.Set<ItemAttributesRQ> retrieveAttributes​(@Nullable
                                                                         AttributeValue... attributeValues)
        Parse ReportPortal attributes from AttributeValue annotations.
        Parameters:
        attributeValues - annotation instances
        Returns:
        a set of ReportPortal attributes
      • retrieveAttributes

        @Nonnull
        public static java.util.Set<ItemAttributesRQ> retrieveAttributes​(@Nullable
                                                                         MultiKeyAttribute... multiKeyAttributes)
        Parse ReportPortal attributes from MultiKeyAttribute annotations.
        Parameters:
        multiKeyAttributes - annotation instances
        Returns:
        a set of ReportPortal attributes
      • retrieveAttributes

        @Nonnull
        public static java.util.Set<ItemAttributesRQ> retrieveAttributes​(@Nullable
                                                                         MultiValueAttribute... multiValueAttributes)
        Parse ReportPortal attributes from MultiValueAttribute annotations.
        Parameters:
        multiValueAttributes - annotation instances
        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
      • retrieveAttributes

        @Nonnull
        public static java.util.Set<ItemAttributesRQ> retrieveAttributes​(@Nonnull
                                                                         java.lang.reflect.Executable executable)
        Scan for attributes annotations on the given executable and its declaration.
        Parameters:
        executable - the executable to scan
        Returns:
        a non-null set of ReportPortal attributes (may be empty if none are found)