org.jacoco.report
Class MultiSourceFileLocator

java.lang.Object
  extended by org.jacoco.report.MultiSourceFileLocator
All Implemented Interfaces:
ISourceFileLocator

public class MultiSourceFileLocator
extends Object
implements ISourceFileLocator

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.


Constructor Summary
MultiSourceFileLocator(int tabWidth)
          Creates a new empty locator.
 
Method Summary
 void add(ISourceFileLocator locator)
          Adds the given locator.
 Reader getSourceFile(String packageName, String fileName)
          Tries to locate the given source file and opens a reader with the appropriate encoding.
 int getTabWidth()
          Returns number of blank characters that represent a tab in source code.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

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 Detail

add

public void add(ISourceFileLocator locator)
Adds the given locator. Locators are queried in the sequence they have been added.

Parameters:
locator - Additional locator to query

getSourceFile

public Reader getSourceFile(String packageName,
                            String fileName)
                     throws IOException
Description copied from interface: ISourceFileLocator
Tries to locate the given source file and opens a reader with the appropriate encoding.

Specified by:
getSourceFile in interface ISourceFileLocator
Parameters:
packageName - VM name of the package
fileName - name of the source file
Returns:
reader if the file could be located, null otherwise
Throws:
IOException - in case of problems while opening the file

getTabWidth

public int getTabWidth()
Description copied from interface: ISourceFileLocator
Returns number of blank characters that represent a tab in source code.

Specified by:
getTabWidth in interface ISourceFileLocator
Returns:
tab width as number of blanks


Copyright © 2009–2023 Mountainminds GmbH & Co. KG. All rights reserved.