public class PatternSearchRequest extends AbstractCharSequenceSearchRequest
A variation of a AbstractCharSequenceSearchRequest
which allows
searching using Pattern
s. This kind of
search request
is mainly useful for
batch processing of documents. A array of patterns has to be set using the
setPatterns(Pattern[])
method. Each one will be executed, in the
indexing order of the array.
The PatternSearchRequest
will provide the matching pattern as the
handback value of Result
. Please see Result.getHandback()
and
MatchConsumer.match(int, int, Object)
for details.
Modifier and Type | Class and Description |
---|---|
protected static class |
PatternSearchRequest.PatternMatcher |
PROPERTY_PAGES
Constructor and Description |
---|
PatternSearchRequest() |
Modifier and Type | Method and Description |
---|---|
protected CharSequenceMatcher |
createMatcher()
Creates a
CharSequenceMatcher . |
Pattern[] |
getPatterns()
Returns the
Pattern s applied to this PatternSearchRequest
or null if no patterns have been applied yet. |
boolean |
isValid()
Extends the
AbstractCharSequenceSearchRequest.isValid() by
requiring a valid array of Pattern s. |
void |
setPatterns(Pattern[] patterns)
Assign an array of Patterns to this
PatternSearchRequest . |
addSearchStateListener, cancel, ensureModifiable, ensureNotRunning, ensureValid, execute, executeSync, getInternalHook, getPages, getResultList, getState, isModifiable, isRunning, removeSearchStateListener, reset, setPages
public void setPatterns(Pattern[] patterns)
PatternSearchRequest
. The array must not be null,
have a zero length and no element in the array may be null
. Is one of the
conditions, mentioned before, violated this method will throw an
IllegalArgumentException
.patterns
- the Pattern
s to search for.IllegalArgumentException
- if the array is null or has zero length.public Pattern[] getPatterns()
Pattern
s applied to this PatternSearchRequest
or null
if no patterns have been applied yet.Pattern
s applied to this PatternSearchRequest
or null
if no patterns have been applied yet.public boolean isValid()
AbstractCharSequenceSearchRequest.isValid()
by
requiring a valid array of Pattern
s. Please see
AbstractCharSequenceSearchRequest.isValid()
for details.isValid
in class AbstractCharSequenceSearchRequest
true
if the configuration is sufficientAbstractCharSequenceSearchRequest.isValid()
protected CharSequenceMatcher createMatcher()
AbstractCharSequenceSearchRequest
CharSequenceMatcher
. This method may never return null.createMatcher
in class AbstractCharSequenceSearchRequest
CharSequenceMatcher
Copyright © 2024 levigo holding gmbh. All rights reserved.