@Beta
public abstract class Configuration
extends java.lang.Object
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.
Constructor and Description |
---|
Configuration() |
Modifier and Type | Method and Description |
---|---|
void |
finishBulkEditing()
Marks the end of a "bulk" editing operation, where values should be
committed to persistent storage.
|
abstract java.io.File |
getBaselineFile()
Returns the baseline file to use, if any.
|
Severity |
getSeverity(Issue issue)
Returns the severity for a given issue.
|
abstract void |
ignore(Context context,
Issue issue,
Location location,
java.lang.String message)
Marks the given warning as "ignored".
|
abstract void |
ignore(Issue issue,
java.io.File file)
Marks the given issue and file combination as being ignored.
|
boolean |
isEnabled(Issue issue)
Returns false if the given issue has been disabled.
|
boolean |
isIgnored(Context context,
Issue issue,
Location location,
java.lang.String message)
Checks whether this issue should be ignored because the user has already
suppressed the error? Note that this refers to individual issues being
suppressed/ignored, not a whole detector being disabled via something
like
isEnabled(Issue) . |
abstract void |
setBaselineFile(java.io.File baselineFile)
Sets the baseline file, if any.
|
abstract void |
setSeverity(Issue issue,
Severity severity)
Sets the severity to be used for this issue.
|
void |
startBulkEditing()
Marks the beginning of a "bulk" editing operation with repeated calls to
setSeverity(com.android.tools.lint.detector.api.Issue, com.android.tools.lint.detector.api.Severity) or ignore(com.android.tools.lint.detector.api.Context, com.android.tools.lint.detector.api.Issue, com.android.tools.lint.detector.api.Location, java.lang.String) . |
public boolean isIgnored(@NonNull Context context, @NonNull Issue issue, @Nullable Location location, @NonNull java.lang.String message)
isEnabled(Issue)
.context
- the context used by the detector when the issue was foundissue
- the issue that was foundlocation
- the location of the issuemessage
- the associated user messagepublic boolean isEnabled(@NonNull Issue issue)
getSeverity(issue) != Severity.IGNORE
.issue
- the issue to checkpublic Severity getSeverity(@NonNull Issue issue)
Issue.getDefaultSeverity()
unless the user has selected a custom
severity (which is tool context dependent).issue
- the issue to look up the severity frompublic abstract void ignore(@NonNull Context context, @NonNull Issue issue, @Nullable Location location, @NonNull java.lang.String message)
context
- The scanning contextissue
- the issue to be ignoredlocation
- The location to ignore the warning at, if anymessage
- The message for the warningpublic abstract void ignore(@NonNull Issue issue, @NonNull java.io.File file)
issue
- the issue to be ignored in the given filefile
- the file to ignore the issue inpublic abstract void setSeverity(@NonNull Issue issue, @Nullable Severity severity)
issue
- the issue to set the severity forseverity
- the severity to associate with this issue, or null to
reset the severity to the defaultpublic void startBulkEditing()
setSeverity(com.android.tools.lint.detector.api.Issue, com.android.tools.lint.detector.api.Severity)
or ignore(com.android.tools.lint.detector.api.Context, com.android.tools.lint.detector.api.Issue, com.android.tools.lint.detector.api.Location, java.lang.String)
. After all the values have been
set, the client must call finishBulkEditing()
. This
allows configurations to avoid doing expensive I/O (such as writing out a
config XML file) for each and every editing operation when they are
applied in bulk, such as from a configuration dialog's "Apply" action.public void finishBulkEditing()
startBulkEditing()
for
details.@Nullable public abstract java.io.File getBaselineFile()
If you have a project with a large number of existing warnings, this lets you set a baseline and only see newly introduced warnings until you get a chance to go back and address the "technical debt" of the earlier warnings.
public abstract void setBaselineFile(@Nullable java.io.File baselineFile)
baselineFile
- getBaselineFile()