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.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 the name of the library contains this resource, or null if resource does not belong
to a library.
|
java.lang.String |
getName()
Returns the name of this resource.
|
com.android.ide.common.rendering.api.ResourceNamespace |
getNamespace()
Returns the
ResourceNamespace of this resource. |
default com.android.ide.common.util.PathString |
getOriginalSource()
Returns the
PathString for the original source file that defined this resource, or
null if this resource is not associated with a file, or the original source is not available. |
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 resource 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 this resource 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
@NonNull java.lang.String getName()
@NonNull com.android.resources.ResourceType getType()
@NonNull com.android.ide.common.rendering.api.ResourceNamespace getNamespace()
ResourceNamespace of this resource.@Nullable java.lang.String getLibraryName()
The contents of the returned string may depend on the build system managing the library dependency.
@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. It 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 resource was created, or null if
the resource is not associated with a file. The file used to create this resource may be
a result of some kind of processing applied on the original source file. In such a case this
method returns a result different from getOriginalSource(). The returned
PathString may point to a file on the local file system, or to a zip file entry.@Nullable default com.android.ide.common.util.PathString getOriginalSource()
PathString for the original source file that defined this resource, or
null if this resource is not associated with a file, or the original source is not available.
The returned PathString may point to a file on the local file system, or to a zip
file entry.boolean isFileBased()