public interface ResourceItem extends Configurable
AbstractResourceRepository (and so the project). Can
be turned into a ResourceValue if the contents of a given resource need to be inspected,
not just its presence.| Modifier and Type | Field and Description |
|---|---|
static java.util.Comparator<ResourceItem> |
BY_KEY
Compares
ResourceItem instances using getKey(). |
| Modifier and Type | Method and Description |
|---|---|
java.io.File |
getFile()
Returns the
File from which this ResourceItem was created. |
java.lang.String |
getKey()
Returns a string that combines the namespace, type, name and qualifiers and should uniquely
identify a resource in a "correct"
AbstractResourceRepository. |
java.lang.String |
getLibraryName()
Returns name of the library which defines this resource, or null for app resources.
|
java.lang.String |
getName()
Returns the name of this resource.
|
com.android.ide.common.rendering.api.ResourceNamespace |
getNamespace()
Returns the of this resource.
|
com.android.ide.common.rendering.api.ResourceReference |
getReferenceToSelf()
Returns a
ResourceReference that points to this resource. |
com.android.ide.common.rendering.api.ResourceValue |
getResourceValue()
Returns a
ResourceValue built from parsing the XML for this resource. |
com.android.resources.ResourceType |
getType()
Returns the type of this resource.
|
boolean |
isFileBased()
Returns true if the
ResourceItem represents a whole file, not an XML tag within a
values XML file. |
getConfigurationstatic final java.util.Comparator<ResourceItem> BY_KEY
ResourceItem instances using getKey().@NonNull java.lang.String getName()
@NonNull com.android.resources.ResourceType getType()
@NonNull com.android.ide.common.rendering.api.ResourceNamespace getNamespace()
@Nullable java.lang.String getLibraryName()
The contents of the string depend on the build system used to create the ResourceItems.
@NonNull com.android.ide.common.rendering.api.ResourceReference getReferenceToSelf()
ResourceReference that points to this resource.@NonNull java.lang.String getKey()
AbstractResourceRepository.
The returned string is not unique if the same resource is declared twice for the same
FolderConfiguration (by mistake most likely) and the resource items were not
merged together during creation.
@Nullable com.android.ide.common.rendering.api.ResourceValue getResourceValue()
ResourceValue built from parsing the XML for this resource. This can be
used to inspect the value of the resource.
The concrete type of the returned object depends on getType().
ResourceValue or null if there was an error parsing the XML or the
XML is no longer accessible (this may be the case in the IDE, when the item is based on
old PSI).@Nullable java.io.File getFile()
File from which this ResourceItem was created.boolean isFileBased()
ResourceItem represents a whole file, not an XML tag within a
values XML file. This is the case for e.g. layouts or colors defined as state lists.