@Immutable public class DefaultIndexedFile extends DefaultInputComponent implements IndexedFile
Constructor and Description |
---|
DefaultIndexedFile(Path absolutePath,
String moduleKey,
String projectRelativePath,
String moduleRelativePath,
InputFile.Type type,
String language,
int batchId,
SensorStrategy sensorStrategy) |
DefaultIndexedFile(String moduleKey,
Path baseDir,
String relativePath,
String language)
Testing purposes only!
|
Modifier and Type | Method and Description |
---|---|
String |
absolutePath()
Normalized absolute path.
|
boolean |
equals(Object o) |
File |
file()
The underlying absolute
File . |
String |
filename()
Filename for this file (inclusing extension).
|
String |
getModuleRelativePath() |
String |
getProjectRelativePath() |
int |
hashCode() |
InputStream |
inputStream()
Creates a stream of the file's contents.
|
boolean |
isFile()
Is the component an
InputFile |
String |
key()
Component key (without branch).
|
String |
language()
Language, for example "java" or "php".
|
String |
moduleKey() |
Path |
path()
The underlying absolute
Path . |
String |
relativePath()
Path relative to module base directory.
|
String |
toString() |
InputFile.Type |
type()
Does it contain main or test code ?
|
URI |
uri()
Identifier of the file.
|
batchId
public DefaultIndexedFile(String moduleKey, Path baseDir, String relativePath, @Nullable String language)
public DefaultIndexedFile(Path absolutePath, String moduleKey, String projectRelativePath, String moduleRelativePath, InputFile.Type type, @Nullable String language, int batchId, SensorStrategy sensorStrategy)
public String relativePath()
IndexedFile
FileSystem
. File separator is the forward
slash ('/'), even on Microsoft Windows.
src/main/java/com/Foo.java
if module base dir is
/path/to/module
and if file is
/path/to/module/src/main/java/com/Foo.java
.
relativePath
in interface IndexedFile
relativePath
in interface InputPath
InputFile.relativePath()
,
InputDir.relativePath()
public String getModuleRelativePath()
public String getProjectRelativePath()
public String absolutePath()
IndexedFile
file().getCanonicalPath()
to resolve symbolic link.absolutePath
in interface IndexedFile
absolutePath
in interface InputPath
InputFile.absolutePath()
,
InputDir.absolutePath()
public File file()
IndexedFile
File
. It should not be used to read the file in the filesystem.file
in interface IndexedFile
file
in interface InputPath
#contents()
,
IndexedFile.inputStream()
public Path path()
IndexedFile
Path
.
It should not be used to read the file in the filesystem.path
in interface IndexedFile
path
in interface InputPath
#contents()
,
IndexedFile.inputStream()
public InputStream inputStream() throws IOException
IndexedFile
inputStream
in interface IndexedFile
IOException
@CheckForNull public String language()
IndexedFile
language
in interface IndexedFile
public InputFile.Type type()
IndexedFile
type
in interface IndexedFile
public String key()
key
in interface InputComponent
public boolean equals(Object o)
equals
in class DefaultInputComponent
public int hashCode()
hashCode
in class DefaultInputComponent
public String toString()
toString
in class DefaultInputComponent
public boolean isFile()
InputComponent
InputFile
isFile
in interface InputComponent
public String filename()
IndexedFile
filename
in interface IndexedFile
public URI uri()
IndexedFile
uri
in interface IndexedFile
uri
in interface InputPath
Copyright © 2009–2018 SonarSource. All rights reserved.