public class ResourceItem extends java.lang.Object implements Configurable, java.lang.Comparable<ResourceItem>
ResourceFile
and an optional Node
in case of a resource coming from a value file.Modifier and Type | Field and Description |
---|---|
protected com.android.ide.common.rendering.api.ResourceValue |
mResourceValue |
Constructor and Description |
---|
ResourceItem(java.lang.String name,
com.android.resources.ResourceType type,
org.w3c.dom.Node value,
java.lang.String libraryName)
Constructs the object with a name, type and optional value.
|
Modifier and Type | Method and Description |
---|---|
int |
compareTo(ResourceItem resourceItem) |
boolean |
compareValueWith(ResourceItem resource)
Compares the ResourceItem
getValue() together and returns true if they are the
same. |
boolean |
equals(java.lang.Object o) |
FolderConfiguration |
getConfiguration()
Returns the
FolderConfiguration for this object. |
java.io.File |
getFile()
For non-values resources, this is the original source file.
|
boolean |
getIgnoredFromDiskMerge() |
java.lang.String |
getKey()
Returns a key for this resource.
|
java.lang.String |
getLibraryName()
Returns the library that the resource was found.
|
java.lang.String |
getName()
Returns the name of the item.
|
java.lang.String |
getQualifiers()
Returns the resource item qualifiers.
|
com.android.ide.common.rendering.api.ResourceValue |
getResourceValue(boolean isFrameworks) |
F |
getSource()
Returns the DataFile the item is coming from.
|
DataFile.FileType |
getSourceType() |
protected int |
getStatus()
Obtains the full status of the data item; should not generally be used except
for debug purposes.
|
com.android.resources.ResourceType |
getType()
Returns the type of the resource.
|
org.w3c.dom.Node |
getValue()
Returns the optional value of the resource.
|
java.lang.String |
getValueText()
Returns the optional string value of the resource.
|
java.lang.String |
getXmlString(com.android.resources.ResourceType type,
boolean system)
Returns a formatted string usable in an XML to use for the
ResourceItem . |
int |
hashCode() |
void |
setIgnoredFromDiskMerge(boolean ignored) |
void |
setSource(F sourceFile)
Sets the DataFile.
|
java.lang.String |
toString() |
protected void |
wasTouched()
Hook invoked when the data item has been touched.
|
@Nullable protected com.android.ide.common.rendering.api.ResourceValue mResourceValue
public ResourceItem(@NonNull java.lang.String name, @NonNull com.android.resources.ResourceType type, @Nullable org.w3c.dom.Node value, @Nullable java.lang.String libraryName)
name
- the name of the resourcetype
- the type of the resourcevalue
- an optional Node that represents the resource value.@NonNull public com.android.resources.ResourceType getType()
@Nullable public org.w3c.dom.Node getValue()
@Nullable public java.lang.String getValueText()
@Nullable public java.lang.String getLibraryName()
@NonNull public java.lang.String getQualifiers()
@NonNull public DataFile.FileType getSourceType()
public FolderConfiguration getConfiguration()
Configurable
FolderConfiguration
for this object.getConfiguration
in interface Configurable
public java.lang.String getKey()
ResourceFile
, this will throw an IllegalStateException
.java.lang.IllegalStateException
- if the resource is not added to a ResourceFileprotected void wasTouched()
@Nullable public com.android.ide.common.rendering.api.ResourceValue getResourceValue(boolean isFrameworks)
public java.lang.String getXmlString(com.android.resources.ResourceType type, boolean system)
ResourceItem
.system
- Whether this is a system resource or a project resource.public boolean compareValueWith(ResourceItem resource)
getValue()
together and returns true if they are the
same.resource
- The ResourceItem object to compare to.public java.lang.String toString()
public boolean equals(java.lang.Object o)
public int hashCode()
public int compareTo(@NonNull ResourceItem resourceItem)
compareTo
in interface java.lang.Comparable<ResourceItem>
public void setIgnoredFromDiskMerge(boolean ignored)
public boolean getIgnoredFromDiskMerge()
@NonNull public java.lang.String getName()
@Nullable public F getSource()
public void setSource(@NonNull F sourceFile)
sourceFile
- the data file, if null then the item is marked as being removed from the
data fileprotected int getStatus()
public java.io.File getFile()
GeneratedResourceItem
overrides it.