com.android.tools.lint.client.api
Class LintRequest

java.lang.Object
  extended by com.android.tools.lint.client.api.LintRequest

@Beta
public class LintRequest
extends java.lang.Object

Information about a request to run lint

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.


Field Summary
protected  LintClient mClient
           
protected  java.util.List<java.io.File> mFiles
           
protected  java.util.Collection<Project> mProjects
           
protected  java.lang.Boolean mReleaseMode
           
protected  java.util.EnumSet<Scope> mScope
           
 
Constructor Summary
LintRequest(LintClient client, java.util.List<java.io.File> files)
          Creates a new LintRequest, to be passed to a LintDriver
 
Method Summary
 LintClient getClient()
          Returns the lint client requesting the lint check
 java.util.List<java.io.File> getFiles()
          Returns the set of files to check with lint.
 Project getMainProject(Project project)
          Returns the project to be used as the main project during analysis.
 java.util.Collection<Project> getProjects()
          Gets the projects for the lint requests.
 java.util.EnumSet<Scope> getScope()
          Sets the scope to use; lint checks which require a wider scope set will be ignored
 java.lang.Boolean isReleaseMode()
          Returns true if lint is invoked as part of a release mode build, false if it is part of a debug mode build, and null if the release mode is not known
 void setProjects(java.util.Collection<Project> projects)
          Sets the projects for the lint requests.
 LintRequest setReleaseMode(java.lang.Boolean releaseMode)
          Sets the release mode.
 LintRequest setScope(java.util.EnumSet<Scope> scope)
          Sets the scope to use; lint checks which require a wider scope set will be ignored
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

mClient

@NonNull
protected final LintClient mClient

mFiles

@NonNull
protected final java.util.List<java.io.File> mFiles

mScope

@Nullable
protected java.util.EnumSet<Scope> mScope

mReleaseMode

@Nullable
protected java.lang.Boolean mReleaseMode

mProjects

@Nullable
protected java.util.Collection<Project> mProjects
Constructor Detail

LintRequest

public LintRequest(@NonNull
                   LintClient client,
                   @NonNull
                   java.util.List<java.io.File> files)
Creates a new LintRequest, to be passed to a LintDriver

Parameters:
client - the tool wrapping the analyzer, such as an IDE or a CLI
files - the set of files to check with lint. This can reference Android projects, or directories containing Android projects, or individual XML or Java files (typically for incremental IDE analysis).
Method Detail

getClient

@NonNull
public LintClient getClient()
Returns the lint client requesting the lint check

Returns:
the client, never null

getFiles

@NonNull
public java.util.List<java.io.File> getFiles()
Returns the set of files to check with lint. This can reference Android projects, or directories containing Android projects, or individual XML or Java files (typically for incremental IDE analysis).

Returns:
the set of files to check, should not be empty

getScope

@Nullable
public java.util.EnumSet<Scope> getScope()
Sets the scope to use; lint checks which require a wider scope set will be ignored

Returns:
the scope to use, or null to use the default

setScope

@NonNull
public LintRequest setScope(@Nullable
                                    java.util.EnumSet<Scope> scope)
Sets the scope to use; lint checks which require a wider scope set will be ignored

Parameters:
scope - the scope
Returns:
this, for constructor chaining

isReleaseMode

@Nullable
public java.lang.Boolean isReleaseMode()
Returns true if lint is invoked as part of a release mode build, false if it is part of a debug mode build, and null if the release mode is not known

Returns:
true if this lint is running in release mode, null if not known

setReleaseMode

@NonNull
public LintRequest setReleaseMode(@Nullable
                                          java.lang.Boolean releaseMode)
Sets the release mode. Use true if lint is invoked as part of a release mode build, false if it is part of a debug mode build, and null if the release mode is not known

Parameters:
releaseMode - true if this lint is running in release mode, null if not known
Returns:
this, for constructor chaining

getProjects

@Nullable
public java.util.Collection<Project> getProjects()
Gets the projects for the lint requests. This is optional; if not provided lint will search the getFiles() directories and look for projects via LintClient.isProjectDirectory(java.io.File). However, this method allows a lint client to set up all the projects ahead of time, and associate those projects with native resources (in an IDE for example, each lint project can be associated with the corresponding IDE project).

Returns:
a collection of projects, or null

setProjects

public void setProjects(@Nullable
                        java.util.Collection<Project> projects)
Sets the projects for the lint requests. This is optional; if not provided lint will search the getFiles() directories and look for projects via LintClient.isProjectDirectory(java.io.File). However, this method allows a lint client to set up all the projects ahead of time, and associate those projects with native resources (in an IDE for example, each lint project can be associated with the corresponding IDE project).

Parameters:
projects - a collection of projects, or null

getMainProject

@NonNull
public Project getMainProject(@NonNull
                                      Project project)
Returns the project to be used as the main project during analysis. This is usually the project itself, but when you are for example analyzing a library project, it can be the app project using the library.

Parameters:
project - the project to look up the main project for
Returns:
the main project