public final class NearestSectionFilter extends Object
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 NearestSectionFilter.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.
NearestSectionFilter.newBuilder(int, int),
Instrumenter.createLoadSourceSectionBinding(NearestSectionFilter, SourceSectionFilter,
LoadSourceSectionListener, boolean),
Instrumenter.attachLoadSourceSectionListener(NearestSectionFilter, SourceSectionFilter,
LoadSourceSectionListener, boolean),
Instrumenter.attachExecutionEventFactory(NearestSectionFilter, SourceSectionFilter,
ExecutionEventNodeFactory)| Modifier and Type | Class and Description |
|---|---|
static class |
NearestSectionFilter.Builder
Builder to configure
NearestSectionFilter before creating its instance. |
| Modifier and Type | Method and Description |
|---|---|
static NearestSectionFilter.Builder |
newBuilder(int line,
int column)
Creates a new
NearestSectionFilter using a builder pattern. |
String |
toString() |
public static NearestSectionFilter.Builder newBuilder(int line, int column)
NearestSectionFilter using a builder pattern. The
filter will find source sections that are nearest to the given source line and column. To
create the final filter finalize it using NearestSectionFilter.Builder.build().line - the line, greater than or equal to 1column - the column, or < 1 when column is unknownNearestSectionFilter instances