Modifier and Type | Field and Description |
---|---|
static String |
SCOPE |
QUALIFIER_CLASS, QUALIFIER_DIRECTORY, QUALIFIER_FIELD, QUALIFIER_FILE, QUALIFIER_LIB, QUALIFIER_METHOD, QUALIFIER_MODULE, QUALIFIER_PACKAGE, QUALIFIER_PROJECT, QUALIFIER_SUBVIEW, QUALIFIER_UNIT_TEST_CLASS, QUALIFIER_VIEW, SCOPE_ENTITY, SCOPE_SET, SCOPE_SPACE
Constructor and Description |
---|
File(Language language,
String key)
Creates a File from its language and its key
|
File(Language language,
String directory,
String filename)
Creates a File from language, directory and filename
|
File(String key)
File in project.
|
File(String directory,
String filename)
Creates a file from its containing directory and name
|
Modifier and Type | Method and Description |
---|---|
static File |
fromIOFile(File file,
List<File> sourceDirs)
Creates a File from an io.file and a list of sources directories
|
static File |
fromIOFile(File file,
Project project)
Creates a File from its name and a project
|
String |
getDescription() |
Language |
getLanguage() |
String |
getLongName() |
String |
getName() |
Directory |
getParent()
The parent is used to build the resources tree, for example for relations between classes, packages and projects.
|
String |
getQualifier()
Returns the qualifier associated to this File.
|
String |
getScope() |
boolean |
matchFilePattern(String antPattern)
Check resource against an Ant pattern, like mypackag?/*Foo.java.
|
void |
setLanguage(Language language)
Sets the language of the file
|
void |
setQualifier(String qualifier) |
String |
toString() |
equals, getEffectiveKey, getId, getKey, hashCode, isExcluded, setEffectiveKey, setExcluded, setId, setKey
public static final String SCOPE
public File(String key)
new File("org/sonar/foo.sql")
. The absolute path may be
c:/myproject/src/main/sql/org/sonar/foo.sql. Project root is c:/myproject and source dir is src/main/sql.public File(String directory, String filename)
public Directory getParent()
Return null if the parent is the project.
getParent
in class Resource<Directory>
Resource.getParent()
public boolean matchFilePattern(String antPattern)
matchFilePattern
in class Resource<Directory>
antPattern
- Ant-like pattern (with **, * and ?). It includes file suffixes.Resource.matchFilePattern(String)
public static File fromIOFile(File file, List<File> sourceDirs)
public static File fromIOFile(File file, Project project)
public String getName()
getName
in class Resource<Directory>
Resource.getName()
public String getLongName()
getLongName
in class Resource<Directory>
Resource.getLongName()
public String getDescription()
getDescription
in class Resource<Directory>
Resource.getDescription()
public Language getLanguage()
getLanguage
in class Resource<Directory>
Resource.getLanguage()
public void setLanguage(Language language)
public String getQualifier()
getQualifier
in class Resource<Directory>
for the list of qualifiers
,
to find out if a resource if a class, a unit test,... from its qualifier
public void setQualifier(String qualifier)
Copyright © 2009-2013 SonarSource. All Rights Reserved.