com.android.ide.common.resources
Class ScanningContext

java.lang.Object
  extended by com.android.ide.common.resources.ScanningContext

public class ScanningContext
extends java.lang.Object

A ScanningContext keeps track of state during a resource file scan, such as any parsing errors encountered, whether Android ids have changed, and so on.


Field Summary
protected  ResourceRepository mRepository
           
 
Constructor Summary
ScanningContext(ResourceRepository repository)
          Constructs a new ScanningContext
 
Method Summary
 void addError(java.lang.String error)
          Adds the given error to the scanning context.
 boolean checkValue(java.lang.String uri, java.lang.String name, java.lang.String value)
          Asks the context to check whether the given attribute name and value is valid in this context.
 java.util.List<java.lang.String> getErrors()
          Returns a list of errors encountered during scanning
 ResourceRepository getRepository()
          Returns the repository associated with this scanning context
 boolean needsFullAapt()
          Returns whether this repository has been marked as "dirty"; if one or more of the constituent files have declared that the resource item names that they provide have changed.
protected  void requestFullAapt()
          Marks that a full aapt compilation of the resources is necessary because it has detected a change that cannot be incrementally handled.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

mRepository

protected final ResourceRepository mRepository
Constructor Detail

ScanningContext

public ScanningContext(@NonNull
                       ResourceRepository repository)
Constructs a new ScanningContext

Parameters:
repository - the associated resource repository
Method Detail

getErrors

@Nullable
public java.util.List<java.lang.String> getErrors()
Returns a list of errors encountered during scanning

Returns:
a list of errors encountered during scanning (or null)

addError

public void addError(@NonNull
                     java.lang.String error)
Adds the given error to the scanning context. The error should use the same syntax as real aapt error messages such that the aapt parser can properly detect the filename, line number, etc.

Parameters:
error - the error message, including file name and line number at the beginning

getRepository

@NonNull
public ResourceRepository getRepository()
Returns the repository associated with this scanning context

Returns:
the associated repository, never null

requestFullAapt

protected void requestFullAapt()
Marks that a full aapt compilation of the resources is necessary because it has detected a change that cannot be incrementally handled.


needsFullAapt

public boolean needsFullAapt()
Returns whether this repository has been marked as "dirty"; if one or more of the constituent files have declared that the resource item names that they provide have changed.

Returns:
true if a full aapt compilation is required

checkValue

public boolean checkValue(@Nullable
                          java.lang.String uri,
                          @NonNull
                          java.lang.String name,
                          @NonNull
                          java.lang.String value)
Asks the context to check whether the given attribute name and value is valid in this context.

Parameters:
uri - the XML namespace URI
name - the attribute local name
value - the attribute value
Returns:
true if the attribute is valid