Class GlobPathFilter

java.lang.Object
org.jboss.modules.filter.GlobPathFilter
All Implemented Interfaces:
PathFilter

final class GlobPathFilter extends Object implements PathFilter
Default implementation of PathFilter. Uses glob based includes and excludes to determine whether to export.
  • Field Details

    • GLOB_PATTERN

      private static final Pattern GLOB_PATTERN
    • glob

      private final String glob
    • pattern

      private final Pattern pattern
  • Constructor Details

    • GlobPathFilter

      GlobPathFilter(String glob)
      Construct a new instance.
      Parameters:
      glob - the path glob to match
  • Method Details

    • accept

      public boolean accept(String path)
      Determine whether a path should be accepted.
      Specified by:
      accept in interface PathFilter
      Parameters:
      path - the path to check
      Returns:
      true if the path should be accepted, false if not
    • getGlobPattern

      private static Pattern getGlobPattern(String glob)
      Get a regular expression pattern which accept any path names which match the given glob. The glob patterns function similarly to ant file patterns. Valid metacharacters in the glob pattern include:
      • "\" - escape the next character (treat it literally, even if it is itself a recognized metacharacter)
      • "?" - match any non-slash character
      • "*" - match zero or more non-slash characters
      • "**" - match zero or more characters, including slashes
      • "/" - match one or more slash characters. Consecutive / characters are collapsed down into one.
      In addition, any glob pattern matches all subdirectories thereof. A glob pattern ending in / is equivalent to a glob pattern ending in /** in that the named directory is not itself included in the glob.

      See also: "Patterns" in the Ant Manual

      Parameters:
      glob - the glob to match
      Returns:
      the pattern
    • hashCode

      public int hashCode()
      Description copied from interface: PathFilter
      Calculate a unique hash code for this path filter. Equal path filters must yield identical hash codes.
      Specified by:
      hashCode in interface PathFilter
      Overrides:
      hashCode in class Object
      Returns:
      the hash code
    • equals

      public boolean equals(Object obj)
      Description copied from interface: PathFilter
      Determine whether this filter is equal to another. Filters must implement meaningful (non-identity) equality semantics.
      Specified by:
      equals in interface PathFilter
      Overrides:
      equals in class Object
      Parameters:
      obj - the other object
      Returns:
      true if this filter is the same
    • equals

      public boolean equals(GlobPathFilter obj)
    • toString

      public String toString()
      Overrides:
      toString in class Object