|
||||||||||
| 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.JavaFile
public class JavaFile
A class that represents a Java class. This class can either be a Test class or source class
| Field Summary |
|---|
| 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 | |
|---|---|
JavaFile(String key)
Creates a source file from its key |
|
JavaFile(String key,
boolean unitTest)
Creates any JavaFile from its key |
|
JavaFile(String packageName,
String className)
Creates a JavaFile that is not a class of test based on package and file names |
|
JavaFile(String packageKey,
String className,
boolean unitTest)
Creates a JavaFile that can be of any type based on package and file names |
|
| Method Summary | |
|---|---|
static JavaFile |
fromAbsolutePath(String path,
List<File> sourceDirs,
boolean unitTest)
Shortcut to fromIOFile with an abolute path |
static JavaFile |
fromIOFile(File file,
List<File> sourceDirs,
boolean unitTest)
Creates a JavaFile from a file in the source directories |
static JavaFile |
fromRelativePath(String relativePath,
boolean unitTest)
|
String |
getDescription()
|
Language |
getLanguage()
|
String |
getLongName()
|
String |
getName()
|
JavaPackage |
getParent()
The parent is used to build the resources tree, for example for relations between classes, packages and projects. |
String |
getQualifier()
The qualifier tells the type of the resource. |
String |
getScope()
|
boolean |
isUnitTest()
|
boolean |
matchFilePattern(String antPattern)
Check resource against an Ant pattern, like mypackag?/*Foo.java. |
String |
toString()
|
| Methods inherited from class org.sonar.api.resources.Resource |
|---|
equals, getEffectiveKey, getId, getKey, hashCode, isExcluded, setEffectiveKey, setExcluded, setId, setKey |
| Methods inherited from class java.lang.Object |
|---|
clone, finalize, getClass, notify, notifyAll, wait, wait, wait |
| Constructor Detail |
|---|
public JavaFile(String packageName,
String className)
public JavaFile(String packageKey,
String className,
boolean unitTest)
unitTest - whether it is a unit test file or a source filepublic JavaFile(String key)
public JavaFile(String key,
boolean unitTest)
unitTest - whether it is a unit test file or a source file| Method Detail |
|---|
public JavaPackage getParent()
Return null if the parent is the project.
getParent in class Resourcepublic String getDescription()
getDescription in class Resourcepublic Language getLanguage()
getLanguage in class Resourcepublic String getName()
getName in class Resourcepublic String getLongName()
getLongName in class Resourcepublic String getScope()
getScope in class Resourcepublic String getQualifier()
Resource
getQualifier in class Resourcefor the list of qualifiers,
to find out if a resource if a class, a unit test,... from its qualifierpublic boolean isUnitTest()
public boolean matchFilePattern(String antPattern)
matchFilePattern in class ResourceantPattern - Ant-like pattern (with **, * and ?). It includes file suffixes.
public static JavaFile fromRelativePath(String relativePath,
boolean unitTest)
public static JavaFile fromIOFile(File file,
List<File> sourceDirs,
boolean unitTest)
public static JavaFile fromAbsolutePath(String path,
List<File> sourceDirs,
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 | |||||||||