com.android.ide.common.resources
Class ResourceFolder

java.lang.Object
  extended by com.android.ide.common.resources.ResourceFolder
All Implemented Interfaces:
Configurable

public final class ResourceFolder
extends java.lang.Object
implements Configurable

Resource Folder class. Contains list of ResourceFiles, the FolderConfiguration, and a link to the IAbstractFolder object.


Constructor Summary
protected ResourceFolder(com.android.resources.ResourceFolderType type, FolderConfiguration config, com.android.io.IAbstractFolder folder, ResourceRepository repository)
          Creates a new ResourceFolder
 
Method Summary
 void addFile(ResourceFile file)
          Adds a ResourceFile to the folder.
protected  void dispose(ScanningContext context)
           
 FolderConfiguration getConfiguration()
          Returns the FolderConfiguration for this object.
 ResourceFile getFile(java.lang.String filename)
          Returns the ResourceFile matching a given name.
 com.android.io.IAbstractFolder getFolder()
          Returns the IAbstractFolder associated with this object.
 ResourceRepository getRepository()
           
 java.util.Collection<com.android.resources.ResourceType> getResourceTypes()
          Returns the list of ResourceTypes generated by the files inside this folder.
 com.android.resources.ResourceFolderType getType()
          Returns the ResourceFolderType of this object.
 boolean hasFile(java.lang.String name)
          Returns whether the folder contains a file with the given name.
 boolean hasResources(com.android.resources.ResourceType type)
          Returns whether a file in the folder is generating a resource of a specified type.
 ResourceFile processFile(com.android.io.IAbstractFile file, ResourceDeltaKind kind, ScanningContext context)
          Processes a file and adds it to its parent folder resource.
protected  void removeFile(ResourceFile file, ScanningContext context)
           
 java.lang.String toString()
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

ResourceFolder

protected ResourceFolder(com.android.resources.ResourceFolderType type,
                         FolderConfiguration config,
                         com.android.io.IAbstractFolder folder,
                         ResourceRepository repository)
Creates a new ResourceFolder

Parameters:
type - The type of the folder
config - The configuration of the folder
folder - The associated IAbstractFolder object.
repository - The associated ResourceRepository
Method Detail

processFile

public ResourceFile processFile(com.android.io.IAbstractFile file,
                                ResourceDeltaKind kind,
                                ScanningContext context)
Processes a file and adds it to its parent folder resource.

Parameters:
file - the underlying resource file.
kind - the file change kind.
context - a context object with state for the current update, such as a place to stash errors encountered
Returns:
the ResourceFile that was created.

addFile

public void addFile(ResourceFile file)
Adds a ResourceFile to the folder.

Parameters:
file - The ResourceFile.

removeFile

protected void removeFile(ResourceFile file,
                          ScanningContext context)

dispose

protected void dispose(ScanningContext context)

getFolder

public com.android.io.IAbstractFolder getFolder()
Returns the IAbstractFolder associated with this object.


getType

public com.android.resources.ResourceFolderType getType()
Returns the ResourceFolderType of this object.


getRepository

public ResourceRepository getRepository()

getResourceTypes

public java.util.Collection<com.android.resources.ResourceType> getResourceTypes()
Returns the list of ResourceTypes generated by the files inside this folder.


getConfiguration

public FolderConfiguration getConfiguration()
Description copied from interface: Configurable
Returns the FolderConfiguration for this object.

Specified by:
getConfiguration in interface Configurable

hasFile

public boolean hasFile(java.lang.String name)
Returns whether the folder contains a file with the given name.

Parameters:
name - the name of the file.

getFile

public ResourceFile getFile(java.lang.String filename)
Returns the ResourceFile matching a given name.

Parameters:
filename - The name of the file to return.
Returns:
the ResourceFile or null if no match was found.

hasResources

public boolean hasResources(com.android.resources.ResourceType type)
Returns whether a file in the folder is generating a resource of a specified type.

Parameters:
type - The ResourceType being looked up.

toString

public java.lang.String toString()
Overrides:
toString in class java.lang.Object