org.sonar.api.batch.fs.internal
Class DefaultInputFile

java.lang.Object
  extended by org.sonar.api.batch.fs.internal.DefaultInputFile
All Implemented Interfaces:
Serializable, InputFile, InputPath
Direct Known Subclasses:
DeprecatedDefaultInputFile

public class DefaultInputFile
extends Object
implements InputFile, Serializable

Since:
4.2
See Also:
Serialized Form

Nested Class Summary
 
Nested classes/interfaces inherited from interface org.sonar.api.batch.fs.InputFile
InputFile.Status, InputFile.Type
 
Constructor Summary
DefaultInputFile(String relativePath)
           
 
Method Summary
 String absolutePath()
          Normalized absolute path.
 boolean equals(Object o)
           
 File file()
          The underlying absolute File
 String hash()
          Digest hash of the file.
 int hashCode()
           
 String key()
          Component key.
 String language()
          Language, for example "java" or "php".
 int lines()
          Number of physical lines.
 String relativePath()
          Path relative to module base directory.
 DefaultInputFile setAbsolutePath(String s)
           
 DefaultInputFile setFile(File file)
           
 DefaultInputFile setHash(String hash)
           
 DefaultInputFile setKey(String s)
           
 DefaultInputFile setLanguage(String language)
           
 DefaultInputFile setLines(int lines)
           
 DefaultInputFile setStatus(InputFile.Status status)
           
 DefaultInputFile setType(InputFile.Type type)
           
 InputFile.Status status()
          setStatus(org.sonar.api.batch.fs.InputFile.Status)
 String toString()
           
 InputFile.Type type()
          Does it contain main or test code ?
 
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
 

Constructor Detail

DefaultInputFile

public DefaultInputFile(String relativePath)
Method Detail

relativePath

public String relativePath()
Description copied from interface: InputFile
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 InputFile
Specified by:
relativePath in interface InputPath
See Also:
InputFile.relativePath(), InputDir.relativePath()

absolutePath

public String absolutePath()
Description copied from interface: InputFile
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 InputFile
Specified by:
absolutePath in interface InputPath
See Also:
InputFile.absolutePath(), InputDir.absolutePath()

file

public File file()
Description copied from interface: InputFile
The underlying absolute File

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

language

public String language()
Description copied from interface: InputFile
Language, for example "java" or "php". It's automatically guessed if it is not set in project settings.

Specified by:
language in interface InputFile

type

public InputFile.Type type()
Description copied from interface: InputFile
Does it contain main or test code ?

Specified by:
type in interface InputFile

status

public InputFile.Status status()
setStatus(org.sonar.api.batch.fs.InputFile.Status)

Specified by:
status in interface InputFile

hash

public String hash()
Digest hash of the file.


lines

public int lines()
Description copied from interface: InputFile
Number of physical lines. This method supports all end-of-line characters. Returns zero if the file is empty.

Specified by:
lines in interface InputFile

key

public String key()
Component key.


setAbsolutePath

public DefaultInputFile setAbsolutePath(String s)

setLanguage

public DefaultInputFile setLanguage(String language)

setFile

public DefaultInputFile setFile(File file)

setType

public DefaultInputFile setType(InputFile.Type type)

setStatus

public DefaultInputFile setStatus(InputFile.Status status)

setHash

public DefaultInputFile setHash(String hash)

setLines

public DefaultInputFile setLines(int lines)

setKey

public DefaultInputFile setKey(String s)

equals

public boolean equals(Object o)
Overrides:
equals in class Object

hashCode

public int hashCode()
Overrides:
hashCode in class Object

toString

public String toString()
Overrides:
toString in class Object


Copyright © 2009–2015 SonarSource. All rights reserved.