Class MultiSourceFileLocator
java.lang.Object
org.jacoco.report.MultiSourceFileLocator
- All Implemented Interfaces:
ISourceFileLocator
- Direct Known Subclasses:
AntResourcesLocator
Locator that searches source files in multiple
ISourceFileLocator
instances. For each lookup request the first locator that returns a
Reader for source content is selected.-
Field Summary
Fields -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionvoidadd(ISourceFileLocator locator) Adds the given locator.getSourceFile(String packageName, String fileName) Tries to locate the given source file and opens a reader with the appropriate encoding.intReturns number of blank characters that represent a tab in source code.
-
Field Details
-
tabWidth
private final int tabWidth -
delegates
-
-
Constructor Details
-
MultiSourceFileLocator
public MultiSourceFileLocator(int tabWidth) Creates a new empty locator.- Parameters:
tabWidth- tab width in source files as number of blanks used for all source files
-
-
Method Details
-
add
Adds the given locator. Locators are queried in the sequence they have been added.- Parameters:
locator- Additional locator to query
-
getSourceFile
Description copied from interface:ISourceFileLocatorTries to locate the given source file and opens a reader with the appropriate encoding.- Specified by:
getSourceFilein interfaceISourceFileLocator- Parameters:
packageName- VM name of the packagefileName- name of the source file- Returns:
- reader if the file could be located,
nullotherwise - Throws:
IOException- in case of problems while opening the file
-
getTabWidth
public int getTabWidth()Description copied from interface:ISourceFileLocatorReturns number of blank characters that represent a tab in source code.- Specified by:
getTabWidthin interfaceISourceFileLocator- Returns:
- tab width as number of blanks
-