com.android.tools.lint.detector.api
Class Context

java.lang.Object
  extended by com.android.tools.lint.detector.api.Context

public class Context
extends Object

Context passed to the detectors during an analysis run. It provides information about the file being analyzed, it allows shared properties (so the detectors can share results), it contains the current location in the document, etc.

TODO: This needs some cleanup. Perhaps we should split up into a FileContext and a ProjectContext.

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
 AtomicBoolean canceled
          Slow-running detectors should check this flag via AtomicBoolean.get() and abort if canceled
 LintClient client
           
 Configuration configuration
           
 Document document
           
 Element element
           
 File file
           
 Location location
           
 IDomParser parser
           
 Project project
           
 EnumSet<Scope> scope
           
 
Constructor Summary
Context(LintClient client, Project project, File file, EnumSet<Scope> scope)
           
 
Method Summary
 String getContents()
           
 Location getLocation(Context context)
           
 Location getLocation(Node node)
           
 Object getProperty(String name)
           
 void setProperty(String name, Object value)
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

project

public final Project project

file

public final File file

client

public final LintClient client

configuration

public final Configuration configuration

scope

public final EnumSet<Scope> scope

document

public Document document

location

public Location location

element

public Element element

parser

public IDomParser parser

canceled

public final AtomicBoolean canceled
Slow-running detectors should check this flag via AtomicBoolean.get() and abort if canceled

Constructor Detail

Context

public Context(LintClient client,
               Project project,
               File file,
               EnumSet<Scope> scope)
Method Detail

getLocation

public Location getLocation(Node node)

getLocation

public Location getLocation(Context context)

getContents

public String getContents()

getProperty

public Object getProperty(String name)

setProperty

public void setProperty(String name,
                        Object value)


Copyright © 2008-2012. All Rights Reserved.