Class Filters


  • @Deprecated
    @InternalApi
    public final class Filters
    extends Object
    Deprecated.
    Internal API, see Filter
    Utility class for working with Filters. Contains builder style methods, apply methods, as well as mechanisms for adapting Filters and FilenameFilters.
    • Method Detail

      • filter

        public static <T> List<T> filter​(Filter<T> filter,
                                         Collection<T> collection)
        Deprecated.
        Filter a given Collection.
        Type Parameters:
        T - Type of the Collection.
        Parameters:
        filter - A Filter upon the Type of objects in the Collection.
        collection - The Collection to filter.
        Returns:
        A List containing only those objects for which the Filter returned true.
      • getFileExtensionFilter

        public static Filter<File> getFileExtensionFilter​(String... extensions)
        Deprecated.
        Get a File Filter for files with the given extensions, ignoring case.
        Parameters:
        extensions - The extensions to filter.
        Returns:
        A File Filter.
      • getDirectoryFilter

        public static Filter<File> getDirectoryFilter()
        Deprecated.
        Get a File Filter for directories.
        Returns:
        A File Filter.
      • getFileExtensionOrDirectoryFilter

        public static Filter<File> getFileExtensionOrDirectoryFilter​(String... extensions)
        Deprecated.
        Get a File Filter for directories or for files with the given extensions, ignoring case.
        Parameters:
        extensions - The extensions to filter.
        Returns:
        A File Filter.
      • toNormalizedFileFilter

        public static Filter<File> toNormalizedFileFilter​(Filter<String> filter)
        Deprecated.
        Given a String Filter, expose as a File Filter. The File paths are normalized to a standard pattern using / as a path separator which can be used cross platform easily in a regular expression based String Filter.
        Parameters:
        filter - A String Filter.
        Returns:
        A File Filter.
      • fromStringFilter

        public static <T> Filter<T> fromStringFilter​(Filter<String> filter)
        Deprecated.
        Given a String Filter, expose as a Filter on another type. The toString() method is called on the objects of the other type and delegated to the String Filter.
        Type Parameters:
        T - The desired type.
        Parameters:
        filter - The existing String Filter.
        Returns:
        A Filter on the desired type.
      • toFilenameFilter

        public static FilenameFilter toFilenameFilter​(Filter<File> filter)
        Deprecated.
        Given a File Filter, expose as a FilenameFilter.
        Parameters:
        filter - The File Filter.
        Returns:
        A FilenameFilter.
      • toFileFilter

        public static Filter<File> toFileFilter​(FilenameFilter filter)
        Deprecated.
        Given a FilenameFilter, expose as a File Filter.
        Parameters:
        filter - The FilenameFilter.
        Returns:
        A File Filter.
      • buildRegexFilterExcludeOverInclude

        public static Filter<String> buildRegexFilterExcludeOverInclude​(List<String> includeRegexes,
                                                                        List<String> excludeRegexes)
        Deprecated.
        Construct a String Filter using set of include and exclude regular expressions. If there are no include regular expressions provide, then a regular expression is added which matches every String by default. A String is included as long as it matches an include regular expression and does not match an exclude regular expression.

        In other words, exclude patterns override include patterns.

        Parameters:
        includeRegexes - The include regular expressions. May be null.
        excludeRegexes - The exclude regular expressions. May be null.
        Returns:
        A String Filter.
      • buildRegexFilterIncludeOverExclude

        public static Filter<String> buildRegexFilterIncludeOverExclude​(List<String> includeRegexes,
                                                                        List<String> excludeRegexes)
        Deprecated.
        Construct a String Filter using set of include and exclude regular expressions. If there are no include regular expressions provide, then a regular expression is added which matches every String by default. A String is included as long as the case that there is an include which matches or there is not an exclude which matches.

        In other words, include patterns override exclude patterns.

        Parameters:
        includeRegexes - The include regular expressions. May be null.
        excludeRegexes - The exclude regular expressions. May be null.
        Returns:
        A String Filter.