Top Description Fields Constructors Methods
org.eclipse.jgit.revwalk.filter

public abstract Class PatternMatchRevFilter

extends RevFilter
Class Inheritance
Known Direct Subclasses
org.eclipse.jgit.revwalk.filter.AuthorRevFilter.PatternSearch, org.eclipse.jgit.revwalk.filter.CommitterRevFilter.PatternSearch, org.eclipse.jgit.revwalk.filter.MessageRevFilter.PatternSearch
Imports
java.io.IOException, java.util.regex.Matcher, .Pattern, org.eclipse.jgit.errors.IncorrectObjectTypeException, .MissingObjectException, org.eclipse.jgit.internal.JGitText, org.eclipse.jgit.lib.Constants, org.eclipse.jgit.revwalk.RevCommit, .RevWalk

Abstract filter that searches text using extended regular expressions.

Field Summary

Modifier and TypeField and Description
private final Matcher
private final String
Inherited from org.eclipse.jgit.revwalk.filter.RevFilter:
ALLMERGE_BASENO_MERGESNONEONLY_MERGES

Constructor Summary

AccessConstructor and Description
protected
PatternMatchRevFilter(String
text of the pattern. Callers may want to surround their pattern with ".*" on either end to allow matching in the middle of the string.
pattern
,
final boolean
should .* be wrapped around the pattern of ^ and $ are missing? Most users will want this set.
innerString
,
final boolean
should forceToRaw(String) be applied to the pattern before compiling it?
rawEncoding
,
final int
flags from java.util.regex.Pattern to control how matching performs.
flags
)

Construct a new pattern matching filter.

Method Summary

Modifier and TypeMethod and Description
protected static final String

Returns:

same pattern, but re-encoded to match our funny raw UTF-8 character sequence org.eclipse.jgit.util.RawCharSequence.
forceToRaw
(String
original pattern string supplied by the user or the application.
patternText
)

Encode a string pattern for faster matching on byte arrays.

public boolean
include(RevWalk
the active walker this filter is being invoked from within.
walker
,
RevCommit
the commit currently being tested. The commit has been parsed and its body is available for inspection only if the filter returns true from requiresCommitBody().
cmit
)

Implements abstract org.eclipse.jgit.revwalk.filter.RevFilter.include.

Determine if the supplied commit should be included in results.

public String

Returns:

the pattern this filter is applying to candidate strings.
pattern
()

Get the pattern this filter uses.

public boolean
requiresCommitBody()

Overrides org.eclipse.jgit.revwalk.filter.RevFilter.requiresCommitBody.

Whether the filter needs the commit body to be parsed.

protected abstract CharSequence

Returns:

sequence for the commit's content that we need to match on.
text
(RevCommit
current commit being evaluated.
cmit
)

Obtain the raw text to match against.

public String
toString()

Overrides org.eclipse.jgit.revwalk.filter.RevFilter.toString.

Returns a string representation of the object.

Inherited from org.eclipse.jgit.revwalk.filter.RevFilter:
clonenegate

Field Detail

compiledPatternback to summary
private final Matcher compiledPattern
patternTextback to summary
private final String patternText

Constructor Detail

PatternMatchRevFilterback to summary
protected PatternMatchRevFilter(String pattern, final boolean innerString, final boolean rawEncoding, final int flags)

Construct a new pattern matching filter.

Parameters
pattern:String

text of the pattern. Callers may want to surround their pattern with ".*" on either end to allow matching in the middle of the string.

innerString:boolean

should .* be wrapped around the pattern of ^ and $ are missing? Most users will want this set.

rawEncoding:boolean

should forceToRaw(String) be applied to the pattern before compiling it?

flags:int

flags from java.util.regex.Pattern to control how matching performs.

Method Detail

forceToRawback to summary
protected static final String forceToRaw(String patternText)

Encode a string pattern for faster matching on byte arrays.

Force the characters to our funny UTF-8 only convention that we use on raw buffers. This avoids needing to perform character set decodes on the individual commit buffers.

Parameters
patternText:String

original pattern string supplied by the user or the application.

Returns:String

same pattern, but re-encoded to match our funny raw UTF-8 character sequence org.eclipse.jgit.util.RawCharSequence.

includeback to summary
public boolean include(RevWalk walker, RevCommit cmit) throws MissingObjectException, IncorrectObjectTypeException, IOException

Implements abstract org.eclipse.jgit.revwalk.filter.RevFilter.include.

Doc from org.eclipse.jgit.revwalk.filter.RevFilter.include.

Determine if the supplied commit should be included in results.

Parameters
walker:RevWalk

the active walker this filter is being invoked from within.

cmit:RevCommit

the commit currently being tested. The commit has been parsed and its body is available for inspection only if the filter returns true from requiresCommitBody().

Returns:boolean

true to include this commit in the results; false to have this commit be omitted entirely from the results.

Annotations
@Override
Exceptions
MissingObjectException:
an object the filter needs to consult to determine its answer does not exist in the Git repository the walker is operating on. Filtering this commit is impossible without the object.
IncorrectObjectTypeException:
an object the filter needed to consult was not of the expected object type. This usually indicates a corrupt repository, as an object link is referencing the wrong type.
IOException:
a loose object or pack file could not be read to obtain data necessary for the filter to make its decision.
patternback to summary
public String pattern()

Get the pattern this filter uses.

Returns:String

the pattern this filter is applying to candidate strings.

requiresCommitBodyback to summary
public boolean requiresCommitBody()

Overrides org.eclipse.jgit.revwalk.filter.RevFilter.requiresCommitBody.

Doc from org.eclipse.jgit.revwalk.filter.RevFilter.requiresCommitBody.

Whether the filter needs the commit body to be parsed.

Returns:boolean

true if the filter needs the commit body to be parsed.

Annotations
@Override
textback to summary
protected abstract CharSequence text(RevCommit cmit)

Obtain the raw text to match against.

Parameters
cmit:RevCommit

current commit being evaluated.

Returns:CharSequence

sequence for the commit's content that we need to match on.

toStringback to summary
public String toString()

Overrides org.eclipse.jgit.revwalk.filter.RevFilter.toString.

Doc from java.lang.Object.toString.

Returns a string representation of the object. Satisfying this method's contract implies a non-null result must be returned.

Returns:String

a string representation of the object

Annotations
@SuppressWarnings:nls
@Override