Top Description Fields Constructors Methods
org.jboss.modules.filter

pack-priv final Class GlobPathFilter

extends Object
implements PathFilter
Class Inheritance
All Implemented Interfaces
org.jboss.modules.filter.PathFilter
Imports
java.util.regex.Matcher, .Pattern

Default implementation of PathFilter. Uses glob based includes and excludes to determine whether to export.
Authors
John E. Bailey, David M. Lloyd

Field Summary

Modifier and TypeField and Description
private final String
private static final Pattern
private final Pattern

Constructor Summary

AccessConstructor and Description
pack-priv
GlobPathFilter(final String
the path glob to match
glob
)

Construct a new instance.

Method Summary

Modifier and TypeMethod and Description
public boolean

Returns:

true if the path should be accepted, false if not
accept
(final String
the path to check
path
)

Implements org.jboss.modules.filter.PathFilter.accept.

Determine whether a path should be accepted.
public boolean
equals(final Object
the other object
obj
)

Overrides java.lang.Object.equals.

Implements org.jboss.modules.filter.PathFilter.equals.

Determine whether this filter is equal to another.
public boolean
private static Pattern

Returns:

the pattern
getGlobPattern
(final String
the glob to match
glob
)

Get a regular expression pattern which accept any path names which match the given glob.

public int
hashCode()

Overrides java.lang.Object.hashCode.

Implements org.jboss.modules.filter.PathFilter.hashCode.

Calculate a unique hash code for this path filter.
public String
toString()

Overrides java.lang.Object.toString.

Returns a string representation of the object.
Inherited from java.lang.Object:
clonefinalizegetClassnotifynotifyAllwaitwaitwait

Field Detail

globback to summary
private final String glob
GLOB_PATTERNback to summary
private static final Pattern GLOB_PATTERN
patternback to summary
private final Pattern pattern

Constructor Detail

GlobPathFilterback to summary
pack-priv GlobPathFilter(final String glob)

Construct a new instance.

Parameters
glob:String

the path glob to match

Method Detail

acceptback to summary
public boolean accept(final String path)

Implements org.jboss.modules.filter.PathFilter.accept.

Determine whether a path should be accepted.

Parameters
path:String

the path to check

Returns:boolean

true if the path should be accepted, false if not

equalsback to summary
public boolean equals(final Object obj)

Overrides java.lang.Object.equals.

Implements org.jboss.modules.filter.PathFilter.equals.

Doc from org.jboss.modules.filter.PathFilter.equals.

Determine whether this filter is equal to another. Filters must implement meaningful (non-identity) equality semantics.

Parameters
obj:Object

the other object

Returns:boolean

true if this filter is the same

equalsback to summary
public boolean equals(final GlobPathFilter obj)
getGlobPatternback to summary
private static Pattern getGlobPattern(final 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:String

the glob to match

Returns:Pattern

the pattern

hashCodeback to summary
public int hashCode()

Overrides java.lang.Object.hashCode.

Implements org.jboss.modules.filter.PathFilter.hashCode.

Doc from org.jboss.modules.filter.PathFilter.hashCode.

Calculate a unique hash code for this path filter. Equal path filters must yield identical hash codes.

Returns:int

the hash code

toStringback to summary
public String toString()

Overrides java.lang.Object.toString.

Doc from java.lang.Object.toString.

Returns a string representation of the object.

Returns:String

a string representation of the object.