@Beta
public abstract class Reporter
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.
| Modifier and Type | Field and Description |
|---|---|
protected LintCliClient |
client |
protected boolean |
displayEmpty |
protected java.io.File |
output |
static java.lang.String |
STDERR |
static java.lang.String |
STDOUT |
protected java.lang.String |
title |
protected java.util.Map<java.lang.String,java.lang.String> |
urlMap |
| Modifier | Constructor and Description |
|---|---|
protected |
Reporter(LintCliClient client,
java.io.File output) |
| Modifier and Type | Method and Description |
|---|---|
static Reporter |
createHtmlReporter(LintCliClient client,
java.io.File output,
LintCliFlags flags)
Creates a new HTML
Reporter |
static TextReporter |
createTextReporter(LintCliClient client,
LintCliFlags flags,
java.io.File file,
java.io.Writer writer,
boolean close)
Constructs a new text
Reporter |
static com.android.tools.lint.XmlReporter |
createXmlReporter(LintCliClient client,
java.io.File output,
boolean intendedForBaseline)
Constructs a new
XmlReporter |
java.io.File |
getOutput()
The report file, if any (reporters may write to stdout/stderr too)
|
java.lang.String |
getTitle() |
static boolean |
hasAutoFix(com.android.tools.lint.detector.api.Issue issue)
Returns true if the given issue has an automatic IDE fix.
|
boolean |
isDisplayEmpty()
Returns whether this report should display info if no issues were found
|
void |
setDisplayEmpty(boolean displayEmpty)
Sets whether this report should display info if no issues were found
|
void |
setStripPrefix(java.lang.String prefix)
Sets path prefix to strip from displayed file names
|
void |
setTitle(java.lang.String title)
Sets the report title
|
void |
setUrlMap(java.util.Map<java.lang.String,java.lang.String> urlMap)
Set mapping of path prefixes to corresponding URLs in the HTML report
|
protected java.lang.String |
stripPath(java.lang.String path) |
abstract void |
write(com.android.tools.lint.LintStats stats,
java.util.List<Warning> issues)
Write the given warnings into the report
|
void |
writeProjectList(com.android.tools.lint.LintStats stats,
java.util.List<com.android.tools.lint.MultiProjectHtmlReporter.ProjectEntry> projects)
Writes a project overview table
|
public static final java.lang.String STDOUT
public static final java.lang.String STDERR
protected final LintCliClient client
protected final java.io.File output
protected java.lang.String title
protected java.util.Map<java.lang.String,java.lang.String> urlMap
protected boolean displayEmpty
protected Reporter(@NonNull
LintCliClient client,
@NonNull
java.io.File output)
@NonNull public static Reporter createHtmlReporter(@NonNull LintCliClient client, @NonNull java.io.File output, @NonNull LintCliFlags flags) throws java.io.IOException
Reporterclient - the associated clientoutput - the output fileflags - the command line flagsjava.io.IOException - if an error occurs@NonNull public static TextReporter createTextReporter(@NonNull LintCliClient client, @NonNull LintCliFlags flags, @Nullable java.io.File file, @NonNull java.io.Writer writer, boolean close)
Reporterclient - the clientflags - the flagsfile - the file corresponding to the writer, if anywriter - the writer to write intoclose - whether the writer should be closed when donepublic static com.android.tools.lint.XmlReporter createXmlReporter(@NonNull
LintCliClient client,
@NonNull
java.io.File output,
boolean intendedForBaseline)
throws java.io.IOException
XmlReporterclient - the clientoutput - the output fileintendedForBaseline - whether this XML report is used to write a baseline filejava.io.IOException - if an error occurspublic abstract void write(@NonNull
com.android.tools.lint.LintStats stats,
java.util.List<Warning> issues)
throws java.io.IOException
stats - the vital statistics for the lint reportissues - the issues to be reported @throws IOException if an error occursjava.io.IOExceptionpublic void writeProjectList(@NonNull
com.android.tools.lint.LintStats stats,
@NonNull
java.util.List<com.android.tools.lint.MultiProjectHtmlReporter.ProjectEntry> projects)
throws java.io.IOException
stats - the vital statistics for the lint reportprojects - the projects to writejava.io.IOExceptionpublic void setTitle(java.lang.String title)
title - the title of the reportpublic java.lang.String getTitle()
@Nullable public java.io.File getOutput()
public void setUrlMap(@Nullable
java.util.Map<java.lang.String,java.lang.String> urlMap)
public boolean isDisplayEmpty()
public void setDisplayEmpty(boolean displayEmpty)
public static boolean hasAutoFix(com.android.tools.lint.detector.api.Issue issue)
issue - the issue to be checkedprotected java.lang.String stripPath(@NonNull
java.lang.String path)
public void setStripPrefix(@Nullable
java.lang.String prefix)