Class Selectors


  • public class Selectors
    extends Object
    Algorithm taken from Apache Ant's SelectorUtils class and modified to handle class hierarchies.
    Author:
    Pete Muir, Apache Ant Team
    • Field Detail

      • DEEP_TREE_MATCH

        public static final String DEEP_TREE_MATCH
        The pattern that matches an arbitrary number of directories.
        Since:
        Ant 1.8.0
        See Also:
        Constant Field Values
    • Method Detail

      • matchPath

        public static boolean matchPath​(String pattern,
                                        String str)
        Tests whether or not a given path matches a given pattern.

        If you need to call this method multiple times with the same pattern you should rather use TokenizedPath

        Parameters:
        pattern - The pattern to match against. Must not be null .
        str - The path to match, as a String. Must not be null.
        Returns:
        true if the pattern matches against the string, or false otherwise.
        See Also:
        TokenizedPath
      • matchPath

        public static boolean matchPath​(String pattern,
                                        String str,
                                        boolean isCaseSensitive)
        Tests whether or not a given path matches a given pattern.

        If you need to call this method multiple times with the same pattern you should rather use TokenizedPattern

        Parameters:
        pattern - The pattern to match against. Must not be null .
        str - The path to match, as a String. Must not be null.
        isCaseSensitive - Whether or not matching should be performed case sensitively.
        Returns:
        true if the pattern matches against the string, or false otherwise.
        See Also:
        TokenizedPattern
      • match

        public static boolean match​(String pattern,
                                    String str,
                                    boolean caseSensitive)
        Tests whether or not a string matches against a pattern. The pattern may contain two special characters:
        '*' means zero or more characters
        '?' means one and only one character
        Parameters:
        pattern - The pattern to match against. Must not be null.
        str - The string which must be matched against the pattern. Must not be null.
        caseSensitive - Whether or not matching should be performed case sensitively.
        Returns:
        true if the string matches against the pattern, or false otherwise.