Interface SourceContextLoader
-
public interface SourceContextLoader
Loads lines of text from source location files to display in things like error messages.
-
-
Nested Class Summary
Nested Classes Modifier and Type Interface Description static class
SourceContextLoader.Line
A pair of line numbers to the contents of lines.
-
Method Summary
All Methods Static Methods Instance Methods Abstract Methods Modifier and Type Method Description static SourceContextLoader
createLineBasedLoader(int defaultCodeLines)
Load context and includedefaultCodeLines
lines leading up to the target line.static SourceContextLoader
createModelAwareLoader(Model model, int defaultCodeLinesHint)
Load context and include the most relevant information possible based on the kind ofFromSourceLocation
.java.util.Collection<SourceContextLoader.Line>
loadContext(FromSourceLocation location)
Attempts to load a file and return contextual source lines for the given source location.
-
-
-
Method Detail
-
loadContext
java.util.Collection<SourceContextLoader.Line> loadContext(FromSourceLocation location)
Attempts to load a file and return contextual source lines for the given source location.- Parameters:
location
- Source location to load.- Returns:
- Returns the loaded source lines.
-
createLineBasedLoader
static SourceContextLoader createLineBasedLoader(int defaultCodeLines)
Load context and includedefaultCodeLines
lines leading up to the target line.- Parameters:
defaultCodeLines
- Number of leading lines to include leading up to the target. Must be greater than 0.- Returns:
- Returns the loader.
- Throws:
java.lang.IllegalArgumentException
- ifdefaultCodeLines
is less than 1.
-
createModelAwareLoader
static SourceContextLoader createModelAwareLoader(Model model, int defaultCodeLinesHint)
Load context and include the most relevant information possible based on the kind ofFromSourceLocation
.- Parameters:
defaultCodeLinesHint
- Limits the number of context lines in some cases. Must be greater than 0.- Returns:
- Returns the loader.
- Throws:
java.lang.IllegalArgumentException
- ifdefaultCodeLinesHint
is less than 1.
-
-