Class PatternExclusionsDependencyFilter

  • All Implemented Interfaces:
    DependencyFilter

    public final class PatternExclusionsDependencyFilter
    extends Object
    A simple filter to exclude artifacts from a list of patterns. The artifact pattern syntax is of the form:
     [groupId]:[artifactId]:[extension]:[version]
     

    Where each pattern segment is optional and supports full and partial * wildcards. An empty pattern segment is treated as an implicit wildcard. Version can be a range in case a VersionScheme is specified.

    For example, org.eclipse.* would match all artifacts whose group id started with org.eclipse. , and :::*-SNAPSHOT would match all snapshot artifacts.

    • Constructor Detail

      • PatternExclusionsDependencyFilter

        public PatternExclusionsDependencyFilter​(String... patterns)
        Creates a new filter using the specified patterns.
        Parameters:
        patterns - The exclude patterns, may be null or empty to exclude no artifacts.
      • PatternExclusionsDependencyFilter

        public PatternExclusionsDependencyFilter​(VersionScheme versionScheme,
                                                 String... patterns)
        Creates a new filter using the specified patterns.
        Parameters:
        versionScheme - To be used for parsing versions/version ranges. If null and pattern specifies a range no artifact will be excluded.
        patterns - The exclude patterns, may be null or empty to exclude no artifacts.
      • PatternExclusionsDependencyFilter

        public PatternExclusionsDependencyFilter​(Collection<String> patterns)
        Creates a new filter using the specified patterns.
        Parameters:
        patterns - The include patterns, may be null or empty to include no artifacts.
      • PatternExclusionsDependencyFilter

        public PatternExclusionsDependencyFilter​(VersionScheme versionScheme,
                                                 Collection<String> patterns)
        Creates a new filter using the specified patterns and VersionScheme .
        Parameters:
        versionScheme - To be used for parsing versions/version ranges. If null and pattern specifies a range no artifact will be excluded.
        patterns - The exclude patterns, may be null or empty to exclude no artifacts.
    • Method Detail

      • accept

        public boolean accept​(DependencyNode node,
                              List<DependencyNode> parents)
        Description copied from interface: DependencyFilter
        Indicates whether the specified dependency node shall be included or excluded.
        Specified by:
        accept in interface DependencyFilter
        Parameters:
        node - The dependency node to filter, must not be null.
        parents - The (read-only) chain of parent nodes that leads to the node to be filtered, must not be null. Iterating this (possibly empty) list walks up the dependency graph towards the root node, i.e. the immediate parent node (if any) is the first node in the list. The size of the list also denotes the zero-based depth of the filtered node.
        Returns:
        true to include the dependency node, false to exclude it.
      • hashCode

        public int hashCode()
        Overrides:
        hashCode in class Object