com.android.ide.common.resources
Class MultiResourceFile

java.lang.Object
  extended by com.android.ide.common.resources.ResourceFile
      extended by com.android.ide.common.resources.MultiResourceFile
All Implemented Interfaces:
Configurable, ValueResourceParser.IValueResourceRepository

public final class MultiResourceFile
extends ResourceFile
implements ValueResourceParser.IValueResourceRepository

Represents a resource file able to declare multiple resources, which could be of different ResourceType.

This is typically an XML file inside res/values.


Constructor Summary
MultiResourceFile(com.android.io.IAbstractFile file, ResourceFolder folder)
           
 
Method Summary
 void addResourceValue(com.android.ide.common.rendering.api.ResourceValue value)
          Adds a resource item to the list
protected  void dispose(ScanningContext context)
           
 java.util.Collection<com.android.resources.ResourceType> getResourceTypes()
          Returns the list of ResourceType generated by the file.
 com.android.ide.common.rendering.api.ResourceValue getValue(com.android.resources.ResourceType type, java.lang.String name)
          Returns the value of a resource generated by this file by ResourceType and name.
 boolean hasResources(com.android.resources.ResourceType type)
          Returns whether the file generated a resource of a specific type.
 boolean hasResourceValue(com.android.resources.ResourceType type, java.lang.String name)
           
protected  void load(ScanningContext context)
           
protected  void update(ScanningContext context)
           
 
Methods inherited from class com.android.ide.common.resources.ResourceFile
getConfiguration, getFile, getFolder, getRepository, isFramework, toString
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

MultiResourceFile

public MultiResourceFile(com.android.io.IAbstractFile file,
                         ResourceFolder folder)
Method Detail

load

protected void load(ScanningContext context)
Specified by:
load in class ResourceFile

update

protected void update(ScanningContext context)
Specified by:
update in class ResourceFile

dispose

protected void dispose(ScanningContext context)
Specified by:
dispose in class ResourceFile

getResourceTypes

public java.util.Collection<com.android.resources.ResourceType> getResourceTypes()
Description copied from class: ResourceFile
Returns the list of ResourceType generated by the file. This is never null.

Specified by:
getResourceTypes in class ResourceFile

hasResources

public boolean hasResources(com.android.resources.ResourceType type)
Description copied from class: ResourceFile
Returns whether the file generated a resource of a specific type.

Specified by:
hasResources in class ResourceFile
Parameters:
type - The ResourceType

addResourceValue

public void addResourceValue(com.android.ide.common.rendering.api.ResourceValue value)
Adds a resource item to the list

Specified by:
addResourceValue in interface ValueResourceParser.IValueResourceRepository
Parameters:
value - The value of the resource.

hasResourceValue

public boolean hasResourceValue(com.android.resources.ResourceType type,
                                java.lang.String name)
Specified by:
hasResourceValue in interface ValueResourceParser.IValueResourceRepository

getValue

public com.android.ide.common.rendering.api.ResourceValue getValue(com.android.resources.ResourceType type,
                                                                   java.lang.String name)
Description copied from class: ResourceFile
Returns the value of a resource generated by this file by ResourceType and name.

If no resource match, null is returned.

Specified by:
getValue in class ResourceFile
Parameters:
type - the type of the resource.
name - the name of the resource.