public class DefaultInputFile extends Object implements InputFile
Modifier and Type | Field and Description |
---|---|
static String |
ATTRIBUTE_COMPONENT_KEY
We're not sure that this is the correct way, so not in API yet.
|
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
Modifier and Type | Method and Description |
---|---|
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?).
|
public static final String ATTRIBUTE_COMPONENT_KEY
public static DefaultInputFile create(File file, String path, Map<String,String> attributes)
InputFile
.
ModuleFileSystem
must be used to search for files to scan.
Usage: InputFile.create(file, "src/main/java/com/Foo.java", attributes)
public String path()
InputFile
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.public String absolutePath()
InputFile
absolutePath
in interface InputFile
public String name()
InputFile
public String type()
InputFile
TYPE_
, for example InputFile.TYPE_SOURCE
.public boolean has(String attribute, String value)
InputFile
@CheckForNull public String attribute(String key)
InputFile
public Map<String,String> attributes()
attributes
in interface InputFile
Copyright © 2009-2014 SonarSource. All Rights Reserved.