Class NearestSectionFilter
The selection of the nearest source location happens based on the provided
SourceSectionFilter
and this nearest section filter to the Instrumenter
create/attach methods. First location candidates are selected according to the
SourceSectionFilter
. Based on this selection a nearest location is found using this
NearestSectionFilter
. If new nearer locations are loaded then the listener/factory will
be notified again. There is at most one nearest SourceSection
at a time, therefore it is
possible to detect updates by remembering and comparing the source section in the
listener/factory.
Start building the nearest filter by calling newBuilder(int, int)
and complete it by calling NearestSectionFilter.Builder.build()
.
A use-case is a debugger breakpoint, for instance, where the exact line or column is not always precise and the location needs to be updated when new code is loaded.
- Since:
- 23.0
- See Also:
-
Nested Class Summary
Modifier and TypeClassDescriptionstatic final class
Builder to configureNearestSectionFilter
before creating its instance. -
Method Summary
Modifier and TypeMethodDescriptionstatic NearestSectionFilter.Builder
newBuilder
(int line, int column) Creates a newNearestSectionFilter
using abuilder
pattern.toString()
-
Method Details
-
newBuilder
Creates a newNearestSectionFilter
using abuilder
pattern. The filter will find source sections that are nearest to the given source line and column. To create the final filter finalize it usingNearestSectionFilter.Builder.build()
.- Parameters:
line
- the line, greater than or equal to1
column
- the column, or < 1 when column is unknown- Returns:
- a new builder to create new
NearestSectionFilter
instances - Since:
- 23.0
-
toString
-