com.android.ide.common.rendering.api
Class ResourceValue

java.lang.Object
  extended by com.android.ide.common.rendering.api.ResourceReference
      extended by com.android.ide.common.rendering.api.ResourceValue
All Implemented Interfaces:
IResourceValue
Direct Known Subclasses:
ArrayResourceValue, AttrResourceValue, DeclareStyleableResourceValue, DensityBasedResourceValue, ItemResourceValue, PluralsResourceValue, StyleResourceValue, TextResourceValue

public class ResourceValue
extends ResourceReference
implements IResourceValue

Represents an android resource with a name and a string value.


Field Summary
protected  java.lang.String mValue
           
 
Constructor Summary
ResourceValue(ResourceType type, java.lang.String name, boolean isFramework)
           
ResourceValue(ResourceType type, java.lang.String name, java.lang.String value, boolean isFramework)
           
 
Method Summary
 boolean equals(java.lang.Object obj)
           
 java.lang.String getRawXmlValue()
          Similar to getValue(), but returns the raw XML value.
 ResourceType getResourceType()
           
 java.lang.String getType()
          Deprecated. use getResourceType() instead.
 java.lang.String getValue()
          Returns the value of the resource, as defined in the XML.
 int hashCode()
           
 void replaceWith(ResourceValue value)
          Sets the value from another resource.
 void setValue(java.lang.String value)
          Sets the value of the resource.
 java.lang.String toString()
           
 
Methods inherited from class com.android.ide.common.rendering.api.ResourceReference
getName, isFramework
 
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
 
Methods inherited from interface com.android.layoutlib.api.IResourceValue
getName, isFramework
 

Field Detail

mValue

protected java.lang.String mValue
Constructor Detail

ResourceValue

public ResourceValue(ResourceType type,
                     java.lang.String name,
                     boolean isFramework)

ResourceValue

public ResourceValue(ResourceType type,
                     java.lang.String name,
                     java.lang.String value,
                     boolean isFramework)
Method Detail

getResourceType

public ResourceType getResourceType()

getType

@Deprecated
public java.lang.String getType()
Deprecated. use getResourceType() instead.

Returns the type of the resource. For instance "drawable", "color", etc...

Specified by:
getType in interface IResourceValue

getValue

public java.lang.String getValue()
Returns the value of the resource, as defined in the XML. This can be null

Specified by:
getValue in interface IResourceValue

getRawXmlValue

public java.lang.String getRawXmlValue()
Similar to getValue(), but returns the raw XML value. This is usually the same as getValue, but with a few exceptions. For example, for markup strings, you can have * <string name="markup">This is <b>bold</b></string>. Here, getValue() will return "This is bold" -- e.g. just the plain text flattened. However, this method will return "This is <b>bold</b>", which preserves the XML markup elements.


setValue

public void setValue(java.lang.String value)
Sets the value of the resource.

Parameters:
value - the new value

replaceWith

public void replaceWith(ResourceValue value)
Sets the value from another resource.

Parameters:
value - the resource value

toString

public java.lang.String toString()
Overrides:
toString in class ResourceReference

hashCode

public int hashCode()
Overrides:
hashCode in class ResourceReference

equals

public boolean equals(java.lang.Object obj)
Overrides:
equals in class ResourceReference