@Immutable public class DefaultIndexedFile extends DefaultInputComponent implements IndexedFile
Constructor and Description |
---|
DefaultIndexedFile(java.nio.file.Path absolutePath,
java.lang.String moduleKey,
java.lang.String projectRelativePath,
java.lang.String moduleRelativePath,
InputFile.Type type,
java.lang.String language,
int batchId,
SensorStrategy sensorStrategy) |
DefaultIndexedFile(java.lang.String moduleKey,
java.nio.file.Path baseDir,
java.lang.String relativePath,
java.lang.String language)
Testing purposes only!
|
Modifier and Type | Method and Description |
---|---|
java.lang.String |
absolutePath()
Normalized absolute path.
|
boolean |
equals(java.lang.Object o) |
java.io.File |
file()
The underlying absolute
File . |
java.lang.String |
filename()
Filename for this file (inclusing extension).
|
java.lang.String |
getModuleRelativePath() |
java.lang.String |
getProjectRelativePath() |
int |
hashCode() |
java.io.InputStream |
inputStream()
Creates a stream of the file's contents.
|
boolean |
isFile()
Is the component an
InputFile |
java.lang.String |
key()
Component key (without branch).
|
java.lang.String |
language()
Language, for example "java" or "php".
|
java.lang.String |
moduleKey() |
java.nio.file.Path |
path()
The underlying absolute
Path . |
java.lang.String |
relativePath()
Path relative to module base directory.
|
java.lang.String |
toString() |
InputFile.Type |
type()
Does it contain main or test code ?
|
java.net.URI |
uri()
Identifier of the file.
|
batchId
public DefaultIndexedFile(java.lang.String moduleKey, java.nio.file.Path baseDir, java.lang.String relativePath, @Nullable java.lang.String language)
public DefaultIndexedFile(java.nio.file.Path absolutePath, java.lang.String moduleKey, java.lang.String projectRelativePath, java.lang.String moduleRelativePath, InputFile.Type type, @Nullable java.lang.String language, int batchId, SensorStrategy sensorStrategy)
public java.lang.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 java.lang.String getModuleRelativePath()
public java.lang.String getProjectRelativePath()
public java.lang.String absolutePath()
IndexedFile
file().getCanonicalPath()
to resolve symbolic link.absolutePath
in interface IndexedFile
absolutePath
in interface InputPath
InputFile.absolutePath()
,
InputDir.absolutePath()
public java.io.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 java.nio.file.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 java.io.InputStream inputStream() throws java.io.IOException
IndexedFile
inputStream
in interface IndexedFile
java.io.IOException
@CheckForNull public java.lang.String language()
IndexedFile
language
in interface IndexedFile
public InputFile.Type type()
IndexedFile
type
in interface IndexedFile
public java.lang.String key()
key
in interface InputComponent
public java.lang.String moduleKey()
public boolean equals(java.lang.Object o)
equals
in class DefaultInputComponent
public int hashCode()
hashCode
in class DefaultInputComponent
public java.lang.String toString()
toString
in class DefaultInputComponent
public boolean isFile()
InputComponent
InputFile
isFile
in interface InputComponent
public java.lang.String filename()
IndexedFile
filename
in interface IndexedFile
public java.net.URI uri()
IndexedFile
uri
in interface IndexedFile
uri
in interface InputPath