public final class SourceSectionFilter.Builder extends Object
SourceSectionFilter
before creating its instance. Specify various
parameters by calling individual SourceSectionFilter.Builder
methods. When done, call SourceSectionFilter.Builder.build()
.Modifier and Type | Method and Description |
---|---|
SourceSectionFilter.Builder |
and(SourceSectionFilter filter)
Adds all the filters defined in the given
filter . |
SourceSectionFilter |
build()
Finalizes and constructs the
SourceSectionFilter instance. |
SourceSectionFilter.Builder |
columnEndsIn(SourceSectionFilter.IndexRange... ranges)
Add a filter for all sources sections where the column ends in one of the given index
ranges.
|
SourceSectionFilter.Builder |
columnIn(int startColumn,
int length)
Add a filter for all source sections where the column is inside a startColumn (first
index inclusive) plus a given length (last index exclusive).
|
SourceSectionFilter.Builder |
columnIn(SourceSectionFilter.IndexRange... ranges)
Add a filter for all source sections where the columns are contained in one of the given
index ranges.
|
SourceSectionFilter.Builder |
columnNotIn(SourceSectionFilter.IndexRange... ranges)
Add a filter for all source sections where columns are not contained in one of the given
index ranges.
|
SourceSectionFilter.Builder |
columnStartsIn(SourceSectionFilter.IndexRange... ranges)
Add a filter for all source sections where the column starts in one of the given index
ranges.
|
SourceSectionFilter.Builder |
includeInternal(boolean internal)
Add a filter that includes or excludes
internal root nodes . |
SourceSectionFilter.Builder |
indexIn(int startIndex,
int length)
Add a filter for all source sections where the index is inside a startIndex (inclusive)
plus a given length (exclusive).
|
SourceSectionFilter.Builder |
indexIn(SourceSectionFilter.IndexRange... ranges)
Add a filter for all source sections which indices are contained in one of the given
index ranges.
|
SourceSectionFilter.Builder |
indexNotIn(SourceSectionFilter.IndexRange... ranges)
Add a filter for all source sections which indices are not contained in one of the given
index ranges.
|
SourceSectionFilter.Builder |
lineEndsIn(SourceSectionFilter.IndexRange... ranges)
Add a filter for all source sections where the line ends in one of the given index
ranges.
|
SourceSectionFilter.Builder |
lineIn(int startLine,
int length)
Add a filter for all source sections where the line is inside a startLine (first index
inclusive) plus a given length (last index exclusive).
|
SourceSectionFilter.Builder |
lineIn(SourceSectionFilter.IndexRange... ranges)
Add a filter for all source sections where lines are contained in one of the given index
ranges.
|
SourceSectionFilter.Builder |
lineIs(int line)
Add a filter for all sources sections where the line is exactly the given line.
|
SourceSectionFilter.Builder |
lineNotIn(SourceSectionFilter.IndexRange... ranges)
Add a filter for all source sections where lines are not contained in one of the given
index ranges.
|
SourceSectionFilter.Builder |
lineStartsIn(SourceSectionFilter.IndexRange... ranges)
Add a filter for all source sections where the line starts in one of the given index
ranges.
|
SourceSectionFilter.Builder |
mimeTypeIs(String... mimeTypes)
Add a filter for all source sections that declare one of the given mime-types.
|
SourceSectionFilter.Builder |
rootNameIs(Predicate<String> predicate)
Adds custom predicate to filter inclusion for
root names . |
SourceSectionFilter.Builder |
rootSourceSectionEquals(SourceSection... section)
Add a filter for all root source sections that equal one of the given source sections.
|
SourceSectionFilter.Builder |
sourceFilter(SourceFilter sourceFilter)
Add a source filter.
|
SourceSectionFilter.Builder |
sourceIs(Source... source)
Add a filter for all source sections that reference one of the given sources.
|
SourceSectionFilter.Builder |
sourceIs(SourceSectionFilter.SourcePredicate predicate)
Adds custom predicate to filter inclusion of
sources . |
SourceSectionFilter.Builder |
sourceSectionAvailableOnly(boolean availableOnly)
Add a filter for available source sections.
|
SourceSectionFilter.Builder |
sourceSectionEquals(SourceSection... section)
Add a filter for all source sections that equal one of the given source sections.
|
SourceSectionFilter.Builder |
tagIs(Class<?>... tags)
Add a filter for all source sections that are tagged with one of the given tags.
|
SourceSectionFilter.Builder |
tagIsNot(Class<?>... tags)
Add a filter for all source sections that are not tagged with one of the given tags.
|
public SourceSectionFilter.Builder sourceFilter(SourceFilter sourceFilter)
public SourceSectionFilter.Builder sourceIs(Source... source)
public SourceSectionFilter.Builder sourceIs(SourceSectionFilter.SourcePredicate predicate)
sources
. The predicate must
always return the same result for a source instance otherwise the behavior is undefined.
The predicate should be able run on multiple threads at the same time.predicate
- a test for inclusionpublic SourceSectionFilter.Builder rootNameIs(Predicate<String> predicate)
root names
. The
root name might be null
if not provided by the guest language. If the
language returns a changing value it is unspecified which root name is going to be
matched. The predicate must always return the same result for a String
instance
otherwise the behavior is undefined. The predicate should be able run on multiple threads
at the same time.predicate
- a test for inclusionpublic SourceSectionFilter.Builder mimeTypeIs(String... mimeTypes)
mimeTypes
- matches one of the given mime typespublic SourceSectionFilter.Builder tagIs(Class<?>... tags)
tags
- matches one of the given tagspublic SourceSectionFilter.Builder tagIsNot(Class<?>... tags)
tags
- matches not one of the given tagspublic SourceSectionFilter.Builder sourceSectionEquals(SourceSection... section)
section
- matches one of the given source sectionspublic SourceSectionFilter.Builder sourceSectionAvailableOnly(boolean availableOnly)
true
then
null
and not available
source sections are
filtered out.availableOnly
- true
to include only non-null and
available
source sections, false
to include all.public SourceSectionFilter.Builder rootSourceSectionEquals(SourceSection... section)
section
- matches one of the given root source sectionspublic SourceSectionFilter.Builder indexNotIn(SourceSectionFilter.IndexRange... ranges)
ranges
- matches indices that are not contained in one of the given index rangespublic SourceSectionFilter.Builder indexIn(SourceSectionFilter.IndexRange... ranges)
ranges
- matches indices that are contained in one of the given index rangespublic SourceSectionFilter.Builder indexIn(int startIndex, int length)
startIndex
- the start index (inclusive)length
- the number of matched characterspublic SourceSectionFilter.Builder lineIn(SourceSectionFilter.IndexRange... ranges)
1
.ranges
- matches lines that are contained in one of the given index rangespublic SourceSectionFilter.Builder lineNotIn(SourceSectionFilter.IndexRange... ranges)
1
.ranges
- matches lines that are not contained in one of the given index rangespublic SourceSectionFilter.Builder lineIn(int startLine, int length)
startLine
- the start line (inclusive)length
- the number of matched linespublic SourceSectionFilter.Builder lineStartsIn(SourceSectionFilter.IndexRange... ranges)
1
.ranges
- matches lines that start in one of the given index rangespublic SourceSectionFilter.Builder lineEndsIn(SourceSectionFilter.IndexRange... ranges)
1
.ranges
- matches lines that end in one of the given index rangespublic SourceSectionFilter.Builder columnIn(SourceSectionFilter.IndexRange... ranges)
1
.ranges
- matches columns that are contained in one of the given index rangespublic SourceSectionFilter.Builder columnNotIn(SourceSectionFilter.IndexRange... ranges)
1
.ranges
- matches columns that are not contained in one of the given index rangespublic SourceSectionFilter.Builder columnIn(int startColumn, int length)
startColumn
- the start column (inclusive)length
- the number of matched columnspublic SourceSectionFilter.Builder columnStartsIn(SourceSectionFilter.IndexRange... ranges)
1
.ranges
- matches columns that start in one of the given index rangespublic SourceSectionFilter.Builder columnEndsIn(SourceSectionFilter.IndexRange... ranges)
1
.ranges
- matches columns that end in one of the given index rangespublic SourceSectionFilter.Builder lineIs(int line)
1
. *line
- the line to be matchedpublic SourceSectionFilter.Builder includeInternal(boolean internal)
internal root nodes
.
By default, internal roots are included, call with false
to exclude internal
code from instrumentation.public SourceSectionFilter.Builder and(SourceSectionFilter filter)
filter
.filter
- an existing filter to be includedpublic SourceSectionFilter build()
SourceSectionFilter
instance.