Top Description Fields Methods
org.eclipse.jgit.ignore

public Interface IMatcher

Known Direct Implementers
org.eclipse.jgit.ignore.internal.AbstractMatcher
Imports
org.eclipse.jgit.annotations.NonNull, org.eclipse.jgit.errors.InvalidPatternException, org.eclipse.jgit.ignore.internal.PathMatcher

Generic path matcher.
Since
5.7

Field Summary

Modifier and TypeField and Description
public static final IMatcher
NO_MATCH

Matcher that does not match any pattern.

Method Summary

Modifier and TypeMethod and Description
public static IMatcher

Returns:

a matcher for the given pattern
createPathMatcher
(String
to match
pattern
,
boolean
whether to match only directories
dirOnly
)

Creates a path matcher for the given pattern.

public boolean

Returns:

true if this matcher pattern matches given string
matches
(String
string which is not null, but might be empty
path
,
boolean
true to assume this path as directory (even if it doesn't end with a slash)
assumeDirectory
,
boolean
true if the match is for the full path: prefix-only matches are not allowed
pathMatch
)

Matches entire given string

public boolean

Returns:

true if this matcher pattern matches given string
matches
(String
string which is not null, but might be empty
segment
,
int
start index, inclusive
startIncl
,
int
end index, exclusive
endExcl
)

Matches only part of given string

Field Detail

NO_MATCHback to summary
public static final IMatcher NO_MATCH

Matcher that does not match any pattern.

Method Detail

createPathMatcherback to summary
public static IMatcher createPathMatcher(String pattern, boolean dirOnly) throws InvalidPatternException

Creates a path matcher for the given pattern. A pattern may contain the wildcards "?", "*", and "**". The directory separator is '/'.

Parameters
pattern:String

to match

dirOnly:boolean

whether to match only directories

Returns:IMatcher

a matcher for the given pattern

Annotations
@NonNull
Exceptions
InvalidPatternException:
if the pattern is invalid
matchesback to summary
public boolean matches(String path, boolean assumeDirectory, boolean pathMatch)

Matches entire given string

Parameters
path:String

string which is not null, but might be empty

assumeDirectory:boolean

true to assume this path as directory (even if it doesn't end with a slash)

pathMatch:boolean

true if the match is for the full path: prefix-only matches are not allowed

Returns:boolean

true if this matcher pattern matches given string

matchesback to summary
public boolean matches(String segment, int startIncl, int endExcl)

Matches only part of given string

Parameters
segment:String

string which is not null, but might be empty

startIncl:int

start index, inclusive

endExcl:int

end index, exclusive

Returns:boolean

true if this matcher pattern matches given string