|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectcom.android.tools.lint.detector.api.Detector
public abstract class Detector
A detector is able to find a particular problem. It might also be thought of as enforcing a rule, but "rule" is a bit overloaded in ADT terminology since ViewRules are used in the Rules API to allow views to specify designtime behavior in the graphical layout editor.
Each detector provides information about the issues it can find, such as an explanation of how to fix the issue, the priority, the category, etc. It also has an id which is used to persistently identify a particular type of error.
NOTE: Detectors might be constructed just once and shared between lint runs, so any per-detector state should be initialized and reset via the before/after methods. NOTE: This is not a public or final API; if you rely on this be prepared to adjust your code for the next tools release.
| Nested Class Summary | |
|---|---|
static interface |
Detector.ClassScanner
Specialized interface for detectors that scan Java class files |
static interface |
Detector.JavaScanner
Specialized interface for detectors that scan Java source files |
static class |
Detector.XmlDetectorAdapter
Concrete implementation of a detector that is a Detector.XmlScanner |
static interface |
Detector.XmlScanner
Specialized interface for detectors that scan XML files |
| Constructor Summary | |
|---|---|
Detector()
|
|
| Method Summary | |
|---|---|
void |
afterCheckFile(Context context)
Analysis has just been finished for a specific file, perform any cleanup or report issues found |
void |
afterCheckProject(Context context)
Analysis has just been finished for the whole project, perform any cleanup or report issues found |
abstract boolean |
appliesTo(Context context,
File file)
Returns true if this detector applies to the given file |
void |
beforeCheckFile(Context context)
Analysis is about to be performed on a specific file, perform any setup steps. |
void |
beforeCheckProject(Context context)
Analysis is about to begin, perform any setup steps. |
abstract Speed |
getSpeed()
Returns the expected speed of this detector |
abstract void |
run(Context context)
Runs the detector |
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Constructor Detail |
|---|
public Detector()
| Method Detail |
|---|
public abstract void run(Context context)
context - the context describing the work to be done
public abstract boolean appliesTo(Context context,
File file)
public void beforeCheckProject(Context context)
TODO: Rename "check" to "scan" here? beforeScanProject, beforeScanFile etc?
public void afterCheckProject(Context context)
public void beforeCheckFile(Context context)
public void afterCheckFile(Context context)
public abstract Speed getSpeed()
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||