public interface ResourceItem extends Configurable
ResourceRepository (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.lang.String |
ATTR_EXAMPLE |
static java.util.Comparator<ResourceItem> |
BY_KEY
Compares
ResourceItem instances using getKey(). |
static java.lang.String |
XLIFF_G_TAG |
static java.lang.String |
XLIFF_NAMESPACE_PREFIX |
| Modifier and Type | Method and Description |
|---|---|
java.lang.String |
getKey()
Returns a string that combines the namespace, type, name and qualifiers and should uniquely
identify a resource in a "correct"
ResourceRepository. |
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.ide.common.util.PathString |
getSource()
Returns the
PathString for the file from which this ResourceItem was
created, or null if the resource is not associated with a file. |
com.android.resources.ResourceType |
getType()
Returns the type of this resource.
|
boolean |
isFileBased()
Returns true if the
ResourceItem represents a whole file or a whole zip file entry,
not an XML tag within a values XML file. |
getConfigurationstatic final java.lang.String XLIFF_NAMESPACE_PREFIX
static final java.lang.String XLIFF_G_TAG
static final java.lang.String ATTR_EXAMPLE
static 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()
ResourceRepository.
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 com.android.ide.common.util.PathString getSource()
PathString for the file from which this ResourceItem was
created, or null if the resource is not associated with a file. The returned
PathString may point to a file on the local file system, or to a zip file entry as
possible for AAR resources.boolean isFileBased()
ResourceItem represents a whole file or a whole zip file entry,
not an XML tag within a values XML file. This is the case for e.g. layouts or colors defined
as state lists.