Package org.jboss.modules.filter
Class GlobPathFilter
java.lang.Object
org.jboss.modules.filter.GlobPathFilter
- All Implemented Interfaces:
PathFilter
Default implementation of PathFilter. Uses glob based includes and excludes to determine whether to export.
-
Field Summary
Fields -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionboolean
Determine whether a path should be accepted.boolean
Determine whether this filter is equal to another.boolean
equals
(GlobPathFilter obj) private static Pattern
getGlobPattern
(String glob) Get a regular expression pattern which accept any path names which match the given glob.int
hashCode()
Calculate a unique hash code for this path filter.toString()
-
Field Details
-
GLOB_PATTERN
-
glob
-
pattern
-
-
Constructor Details
-
GlobPathFilter
GlobPathFilter(String glob) Construct a new instance.- Parameters:
glob
- the path glob to match
-
-
Method Details
-
accept
Determine whether a path should be accepted.- Specified by:
accept
in interfacePathFilter
- Parameters:
path
- the path to check- Returns:
- true if the path should be accepted, false if not
-
getGlobPattern
Get a regular expression pattern which accept any path names which match the given glob. The glob patterns function similarly toant
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.
/
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 interfacePathFilter
- Overrides:
hashCode
in classObject
- Returns:
- the hash code
-
equals
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 interfacePathFilter
- Overrides:
equals
in classObject
- Parameters:
obj
- the other object- Returns:
true
if this filter is the same
-
equals
-
toString
-