|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectorg.sonar.api.resources.Resource
org.sonar.api.resources.File
public class File
This class is an implementation of a resource of type FILE
| Field Summary | |
|---|---|
static String |
SCOPE
|
| Fields inherited from class org.sonar.api.resources.Resource |
|---|
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 Summary | |
|---|---|
File(Language language,
String relativePathFromSourceDir)
Deprecated. since 4.2 use fromIOFile(java.io.File, Project) |
|
File(Language language,
String relativeDirectoryPathFromSourceDir,
String filename)
Deprecated. since 4.2 use fromIOFile(java.io.File, Project) |
|
File(String relativePathFromSourceDir)
Deprecated. since 4.2 use fromIOFile(java.io.File, Project) |
|
File(String relativeDirectoryPathFromSourceDir,
String filename)
Deprecated. since 4.2 use fromIOFile(java.io.File, Project) |
|
| Method Summary | |
|---|---|
static File |
create(String relativePathFromBasedir)
Create a File that is partially initialized. |
static File |
create(String relativePathFromBasedir,
String relativePathFromSourceDir,
Language language,
boolean unitTest)
Create a file that is fully initialized. |
static File |
fromIOFile(File file,
List<File> sourceDirs)
Deprecated. since 4.2 use fromIOFile(java.io.File, Project) |
static File |
fromIOFile(File file,
Project module)
Deprecated. since 4.5 use FileSystem.inputFile(org.sonar.api.batch.fs.FilePredicate) |
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()
|
| Methods inherited from class org.sonar.api.resources.Resource |
|---|
equals, getDeprecatedKey, getEffectiveKey, getId, getKey, getPath, hashCode, isExcluded, normalize, setDeprecatedKey, setEffectiveKey, setExcluded, setId, setKey, setPath |
| Methods inherited from class java.lang.Object |
|---|
clone, finalize, getClass, notify, notifyAll, wait, wait, wait |
| Field Detail |
|---|
public static final String SCOPE
| Constructor Detail |
|---|
@Deprecated public File(String relativePathFromSourceDir)
fromIOFile(java.io.File, Project)
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.
@Deprecated
public File(String relativeDirectoryPathFromSourceDir,
String filename)
fromIOFile(java.io.File, Project)
@Deprecated
public File(Language language,
String relativePathFromSourceDir)
fromIOFile(java.io.File, Project)
@Deprecated
public File(Language language,
String relativeDirectoryPathFromSourceDir,
String filename)
fromIOFile(java.io.File, Project)
| Method Detail |
|---|
public Directory getParent()
Return null if the parent is the project.
getParent in class ResourceResource.getParent()public boolean matchFilePattern(String antPattern)
matchFilePattern in class ResourceantPattern - Ant-like pattern (with **, * and ?). It includes file suffixes.
Resource.matchFilePattern(String)
@Deprecated
@CheckForNull
public static File fromIOFile(File file,
List<File> sourceDirs)
fromIOFile(java.io.File, Project)
@Deprecated
@CheckForNull
public static File fromIOFile(File file,
Project module)
FileSystem.inputFile(org.sonar.api.batch.fs.FilePredicate)
File from an absolute File and a module.
The returned File can be then passed for example to
SensorContext.saveMeasure(Resource, org.sonar.api.measures.Measure).
file - absolute path to a filemodule -
public String getName()
getName in class ResourceResource.getName()public String getLongName()
getLongName in class ResourceResource.getLongName()public String getDescription()
getDescription in class ResourceResource.getDescription()public Language getLanguage()
getLanguage in class ResourceFiles have a non null value.Resource.getLanguage()public void setLanguage(Language language)
public final String getScope()
getScope in class Resourcepublic String getQualifier()
getQualifier in class Resourcefor the list of qualifiers,
to find out if a resource if a class, a unit test,... from its qualifierpublic void setQualifier(String qualifier)
public static File create(String relativePathFromBasedir)
SensorContext.saveMeasure(Resource, org.sonar.api.measures.Measure) when resources are already indexed.
Internal use only.
public static File create(String relativePathFromBasedir,
String relativePathFromSourceDir,
Language language,
boolean unitTest)
public String toString()
toString in class Object
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||