com.android.tools.lint.detector.api
Class Detector.XmlDetectorAdapter

java.lang.Object
  extended by com.android.tools.lint.detector.api.Detector
      extended by com.android.tools.lint.detector.api.Detector.XmlDetectorAdapter
All Implemented Interfaces:
Detector.XmlScanner
Direct Known Subclasses:
ResourceXmlDetector
Enclosing class:
Detector

public abstract static class Detector.XmlDetectorAdapter
extends Detector
implements Detector.XmlScanner

Concrete implementation of a detector that is a Detector.XmlScanner


Nested Class Summary
 
Nested classes/interfaces inherited from class com.android.tools.lint.detector.api.Detector
Detector.ClassScanner, Detector.JavaScanner, Detector.XmlDetectorAdapter, Detector.XmlScanner
 
Field Summary
 
Fields inherited from interface com.android.tools.lint.detector.api.Detector.XmlScanner
ALL
 
Constructor Summary
Detector.XmlDetectorAdapter()
           
 
Method Summary
 boolean appliesTo(Context context, File file)
          Returns true if this detector applies to the given file
 Collection<String> getApplicableAttributes()
          Returns the list of attributes that this detector wants to analyze.
 Collection<String> getApplicableElements()
          Returns the list of elements that this detector wants to analyze.
 void run(Context context)
          Runs the detector
 void visitAttribute(Context context, Attr attribute)
          Visit the given attribute.
 void visitDocument(Context context, Document document)
          Visit the given document.
 void visitElement(Context context, Element element)
          Visit the given element.
 void visitElementAfter(Context context, Element element)
          Visit the given element after its children have been analyzed.
 
Methods inherited from class com.android.tools.lint.detector.api.Detector
afterCheckFile, afterCheckProject, beforeCheckFile, beforeCheckProject, getSpeed
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

Detector.XmlDetectorAdapter

public Detector.XmlDetectorAdapter()
Method Detail

run

public void run(Context context)
Description copied from class: Detector
Runs the detector

Specified by:
run in class Detector
Parameters:
context - the context describing the work to be done

appliesTo

public boolean appliesTo(Context context,
                         File file)
Description copied from class: Detector
Returns true if this detector applies to the given file

Specified by:
appliesTo in class Detector

visitDocument

public void visitDocument(Context context,
                          Document document)
Description copied from interface: Detector.XmlScanner
Visit the given document. The detector is responsible for its own iteration through the document.

Specified by:
visitDocument in interface Detector.XmlScanner
Parameters:
context - information about the document being analyzed
document - the document to examine

visitElement

public void visitElement(Context context,
                         Element element)
Description copied from interface: Detector.XmlScanner
Visit the given element.

Specified by:
visitElement in interface Detector.XmlScanner
Parameters:
context - information about the document being analyzed
element - the element to examine

visitElementAfter

public void visitElementAfter(Context context,
                              Element element)
Description copied from interface: Detector.XmlScanner
Visit the given element after its children have been analyzed.

Specified by:
visitElementAfter in interface Detector.XmlScanner
Parameters:
context - information about the document being analyzed
element - the element to examine

visitAttribute

public void visitAttribute(Context context,
                           Attr attribute)
Description copied from interface: Detector.XmlScanner
Visit the given attribute.

Specified by:
visitAttribute in interface Detector.XmlScanner
Parameters:
context - information about the document being analyzed
attribute - the attribute node to examine

getApplicableElements

public Collection<String> getApplicableElements()
Description copied from interface: Detector.XmlScanner
Returns the list of elements that this detector wants to analyze. If non null, this detector will be called (specifically, the Detector.XmlScanner.visitElement(com.android.tools.lint.detector.api.Context, org.w3c.dom.Element) method) for each matching element in the document.

If this method returns null, and Detector.XmlScanner.getApplicableAttributes() also returns null, then the Detector.XmlScanner.visitDocument(com.android.tools.lint.detector.api.Context, org.w3c.dom.Document) method will be called instead.

Specified by:
getApplicableElements in interface Detector.XmlScanner
Returns:
a collection of elements, or null, or the special Detector.XmlScanner.ALL marker to indicate that every single element should be analyzed.

getApplicableAttributes

public Collection<String> getApplicableAttributes()
Description copied from interface: Detector.XmlScanner
Returns the list of attributes that this detector wants to analyze. If non null, this detector will be called (specifically, the Detector.XmlScanner.visitAttribute(com.android.tools.lint.detector.api.Context, org.w3c.dom.Attr) method) for each matching attribute in the document.

If this method returns null, and Detector.XmlScanner.getApplicableElements() also returns null, then the Detector.XmlScanner.visitDocument(com.android.tools.lint.detector.api.Context, org.w3c.dom.Document) method will be called instead.

Specified by:
getApplicableAttributes in interface Detector.XmlScanner
Returns:
a collection of attributes, or null, or the special Detector.XmlScanner.ALL marker to indicate that every single attribute should be analyzed.


Copyright © 2008-2012. All Rights Reserved.