org.sonar.api.batch.fs
Interface InputFile

All Superinterfaces:
InputPath, Serializable
All Known Implementing Classes:
DefaultInputFile, DeprecatedDefaultInputFile

public interface InputFile
extends InputPath

This layer over File adds information for code analyzers.

Since:
4.2

Nested Class Summary
static class InputFile.Status
          Status regarding previous analysis
static class InputFile.Type
           
 
Method Summary
 String absolutePath()
          Normalized absolute path.
 File file()
          The underlying absolute File
 String language()
          Language, for example "java" or "php".
 int lines()
          Number of physical lines.
 String relativePath()
          Path relative to module base directory.
 InputFile.Status status()
          Status regarding previous analysis
 InputFile.Type type()
          Does it contain main or test code ?
 

Method Detail

relativePath

String relativePath()
Path relative to module base directory. Path is unique and identifies file within given FileSystem. File separator is the forward slash ('/'), even on Microsoft Windows.

Returns 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.

Relative path is not null and is normalized ('foo/../foo' is replaced by 'foo').

Specified by:
relativePath in interface InputPath
See Also:
relativePath(), InputDir.relativePath()

absolutePath

String absolutePath()
Normalized absolute path. File separator is forward slash ('/'), even on Microsoft Windows.

This is not canonical path. Symbolic links are not resolved. For example if /project/src links to /tmp/src and basedir is /project, then this method returns /project/src/index.php. Use file().getCanonicalPath() to resolve symbolic link.

Specified by:
absolutePath in interface InputPath
See Also:
absolutePath(), InputDir.absolutePath()

file

File file()
The underlying absolute File

Specified by:
file in interface InputPath
See Also:
file(), InputDir.file()

language

String language()
Language, for example "java" or "php". It's automatically guessed if it is not set in project settings.


type

InputFile.Type type()
Does it contain main or test code ?


status

InputFile.Status status()
Status regarding previous analysis


lines

int lines()
Number of physical lines. This method supports all end-of-line characters. Returns zero if the file is empty.



Copyright © 2009–2015 SonarSource. All rights reserved.