org.sonar.api.scan.filesystem.internal
Class DefaultInputFile

java.lang.Object
  extended by org.sonar.api.scan.filesystem.internal.DefaultInputFile
All Implemented Interfaces:
Serializable, InputFile

public class DefaultInputFile
extends Object
implements InputFile

PLUGINS MUST NOT USE THIS CLASS, EVEN FOR UNIT TESTING.

Since:
4.0
See Also:
Serialized Form

Field Summary
static String ATTRIBUTE_COMPONENT_KEY
          We're not sure that this is the correct way, so not in API yet.
 
Fields inherited from interface org.sonar.api.scan.filesystem.internal.InputFile
ATTRIBUTE_HASH, ATTRIBUTE_LANGUAGE, ATTRIBUTE_SOURCE_RELATIVE_PATH, ATTRIBUTE_SOURCEDIR_PATH, ATTRIBUTE_STATUS, ATTRIBUTE_TYPE, STATUS_ADDED, STATUS_CHANGED, STATUS_SAME, TYPE_SOURCE, TYPE_TEST
 
Method Summary
 String absolutePath()
          Not-null canonical path.
 String attribute(String key)
          See list of attribute keys in constants starting with ATTRIBUTE_.
 Map<String,String> attributes()
           
static DefaultInputFile create(File file, String path, Map<String,String> attributes)
          Plugins must not build their own instances of InputFile.
 boolean equals(Object o)
           
 File file()
           
 boolean has(String attribute, String value)
          Does the given attribute have the given value ?
 int hashCode()
           
 String name()
          Not-null filename, including extension
 String path()
          Path is relative from module base directory.
 String toString()
           
 String type()
          Not-null type (is it a source file or a unit test file?).
 
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
 

Field Detail

ATTRIBUTE_COMPONENT_KEY

public static final String ATTRIBUTE_COMPONENT_KEY
We're not sure that this is the correct way, so not in API yet.

See Also:
Constant Field Values
Method Detail

create

public static DefaultInputFile create(File file,
                                      String path,
                                      Map<String,String> attributes)
Plugins must not build their own instances of InputFile. ModuleFileSystem must be used to search for files to scan.

Usage: InputFile.create(file, "src/main/java/com/Foo.java", attributes)


path

public String path()
Description copied from interface: InputFile
Path is relative from module base directory. Path is unique and identifies file within given ModuleFileSystem. File separator is the forward slash ('/'), even on MSWindows.

Returns src/main/java/com/Foo.java if module base dir is /absolute/path/to/module and if file is /absolute/path/to/module/src/main/java/com/Foo.java.

Returned path is never null.

Specified by:
path in interface InputFile

absolutePath

public String absolutePath()
Description copied from interface: InputFile
Not-null canonical path. File separator is forward slash ('/'), even on MSWindows.

Specified by:
absolutePath in interface InputFile

file

public File file()
Specified by:
file in interface InputFile

name

public String name()
Description copied from interface: InputFile
Not-null filename, including extension

Specified by:
name in interface InputFile

type

public String type()
Description copied from interface: InputFile
Not-null type (is it a source file or a unit test file?). See constant values prefixed by TYPE_, for example InputFile.TYPE_SOURCE.

Specified by:
type in interface InputFile

has

public boolean has(String attribute,
                   String value)
Description copied from interface: InputFile
Does the given attribute have the given value ?

Specified by:
has in interface InputFile

attribute

@CheckForNull
public String attribute(String key)
Description copied from interface: InputFile
See list of attribute keys in constants starting with ATTRIBUTE_.

Specified by:
attribute in interface InputFile

attributes

public Map<String,String> attributes()
Specified by:
attributes in interface InputFile

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-2014 SonarSource. All Rights Reserved.