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>
Constructor Summary |
File(java.lang.String key)
File in project. |
File(java.lang.String directory,
java.lang.String filename)
|
Method Summary |
static File |
fromIOFile(java.io.File file,
java.util.List<java.io.File> sourceDirs)
|
static File |
fromIOFile(java.io.File file,
Project project)
|
Directory |
getParent()
The parent is used to build the resources tree, for example for relations between classes, packages and projects. |
boolean |
matchFilePattern(java.lang.String antPattern)
Check resource against an Ant pattern, like mypackag?/*Foo.java. |
Methods inherited from class org.sonar.api.resources.AbstractResource |
equals, getDescription, getKey, getLanguage, getName, getQualifier, getScope, hashCode, setDescription, setKey, setLanguage, setName, setQualifier, toString |
Methods inherited from class java.lang.Object |
clone, finalize, getClass, notify, notifyAll, wait, wait, wait |
File
public File(java.lang.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(java.lang.String directory,
java.lang.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(java.lang.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(java.io.File file,
java.util.List<java.io.File> sourceDirs)
fromIOFile
public static File fromIOFile(java.io.File file,
Project project)
Copyright © 2009 SonarSource SA. All Rights Reserved.