org.sonar.api.resources
Class File
java.lang.Object
org.sonar.api.resources.AbstractResource<Directory>
org.sonar.api.resources.File
- All Implemented Interfaces:
- Resource
public class File
- extends AbstractResource<Directory>
- Since:
- 1.10
Fields inherited from interface org.sonar.api.resources.Resource |
QUALIFIER_CLASS, QUALIFIER_DIRECTORY, QUALIFIER_FILE, QUALIFIER_MODULE, QUALIFIER_PACKAGE, QUALIFIER_PROJECT, QUALIFIER_PROJECT_BRANCH, QUALIFIER_PROJECT_TRUNK, QUALIFIER_SUBVIEW, QUALIFIER_UNIT_TEST_CLASS, QUALIFIER_VIEW, SCOPE_DIRECTORY, SCOPE_ENTITY, SCOPE_FILE, SCOPE_PROJECT, SCOPE_SET, SCOPE_SPACE |
Methods inherited from class org.sonar.api.resources.AbstractResource |
equals, getDescription, getKey, getLanguage, getName, getQualifier, getScope, hashCode, setDescription, setKey, setLanguage, setName, setQualifier, toString |
File
public File(String key)
- File in project. Key is the path relative to project source directories. It is not the absolute path
and it does not include the path to source directories. Example :
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.
File
public File(String directory,
String filename)
File
public File(Language language,
String key)
File
public File(Language language,
String directory,
String filename)
getParent
public Directory getParent()
- Description copied from interface:
Resource
- The parent is used to build the resources tree, for example for relations between classes, packages and projects.
Return null if the parent is the project.
- Specified by:
getParent
in interface Resource
- Overrides:
getParent
in class AbstractResource<Directory>
matchFilePattern
public boolean matchFilePattern(String antPattern)
- Description copied from interface:
Resource
- Check resource against an Ant pattern, like mypackag?/*Foo.java. It's used for example
to match resource exclusions.
- Parameters:
antPattern
- Ant-like pattern (with **, * and ?). It includes file suffixes.
- Returns:
- true if the resource matches the Ant pattern
fromIOFile
public static File fromIOFile(File file,
List<File> sourceDirs)
fromIOFile
public static File fromIOFile(File file,
Project project)
Copyright © 2009 SonarSource SA. All Rights Reserved.