Class PropertyMatchers

    • Constructor Detail

      • PropertyMatchers

        public PropertyMatchers()
    • Method Detail

      • addAll

        public void addAll​(PropertyMatcher... matchers)
        Adds one or more property matchers.
        Parameters:
        matchers - property matchers
      • remove

        public int remove​(String field)
        Removes all matchers for a given field.
        Parameters:
        field - the field to remove matchers on
        Returns:
        how many matchers were removed
      • matches

        public boolean matches​(Properties properties)
        Returns true if any of the properties key and values match any of the property matchers.
        Parameters:
        properties - the properties to look for a match
        Returns:
        true if at least one value for the key matches the list of matcher regular expressions
      • test

        public boolean test​(Properties properties)
        For compatibility with Predicate. Same as invoking matches(Properties).
        Specified by:
        test in interface Predicate<Properties>
        Parameters:
        properties - the properties to look for a match
        Returns:
        true if at least one value for the key matches the list of matcher regular expressions
      • match

        public Properties match​(Properties properties)
        Returns a new instance that is a subset of the given properties, containing only keys and matching values.
        Parameters:
        properties - the properties to look for a match
        Returns:
        a list of matching values, or an empty list
        See Also:
        test(Properties)
      • replace

        public Properties replace​(Properties properties,
                                  String replacement)
        Returns properties that were replaced (or empty).
        Parameters:
        properties - the properties to look for a match and replace
        replacement - text replacement
        Returns:
        properties that were replaced