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

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

public abstract class ResourceXmlDetector
extends Detector.XmlDetectorAdapter

Specialized detector intended for XML resources. Detectors that apply to XML resources should extend this detector instead since it provides special iteration hooks that are more efficient.

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.


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
ResourceXmlDetector()
           
 
Method Summary
 boolean appliesTo(Context context, File file)
          Returns true if this detector applies to the given file
 boolean appliesTo(com.android.resources.ResourceFolderType folderType)
          Returns whether this detector applies to the given folder type.
 void run(Context context)
          Runs the detector
 
Methods inherited from class com.android.tools.lint.detector.api.Detector.XmlDetectorAdapter
getApplicableAttributes, getApplicableElements, visitAttribute, visitDocument, visitElement, visitElementAfter
 
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

ResourceXmlDetector

public ResourceXmlDetector()
Method Detail

appliesTo

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

Overrides:
appliesTo in class Detector.XmlDetectorAdapter

appliesTo

public boolean appliesTo(com.android.resources.ResourceFolderType folderType)
Returns whether this detector applies to the given folder type. This allows the detectors to be pruned from iteration, so for example when we are analyzing a string value file we don't need to look up detectors related to layout.

Parameters:
folderType - the folder type to be visited
Returns:
true if this detector can apply to resources in folders of the given type

run

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

Overrides:
run in class Detector.XmlDetectorAdapter
Parameters:
context - the context describing the work to be done


Copyright © 2008-2012. All Rights Reserved.