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

java.lang.Object
  extended by com.android.ide.common.rendering.api.ResourceReference
      extended by com.android.ide.common.rendering.api.ResourceValue
          extended by com.android.ide.common.rendering.api.PluralsResourceValue
All Implemented Interfaces:
IResourceValue

public class PluralsResourceValue
extends ResourceValue

Represents an android plurals resource


Field Summary
 
Fields inherited from class com.android.ide.common.rendering.api.ResourceValue
mValue
 
Constructor Summary
PluralsResourceValue(java.lang.String name, boolean isFramework)
          Constructs a new PluralsResourceValue
 
Method Summary
 void addPlural(java.lang.String quantity, java.lang.String value)
          Adds an element into the array
 int getPluralsCount()
          Returns the number of plural string
 java.lang.String getQuantity(int index)
          Returns the quantity at the given index, such as "one", "two", "few", etc.
 java.lang.String getValue()
          Returns the value of the resource, as defined in the XML.
 java.lang.String getValue(int index)
          Returns the string element at the given index position.
 java.lang.String getValue(java.lang.String quantity)
          Returns the string element for the given quantity
 
Methods inherited from class com.android.ide.common.rendering.api.ResourceValue
equals, getRawXmlValue, getResourceType, getType, hashCode, replaceWith, setValue, 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
 

Constructor Detail

PluralsResourceValue

public PluralsResourceValue(java.lang.String name,
                            boolean isFramework)
Constructs a new PluralsResourceValue

Parameters:
name - the name of the array
isFramework - whether this is a framework resource
Method Detail

addPlural

public void addPlural(java.lang.String quantity,
                      java.lang.String value)
Adds an element into the array


getPluralsCount

public int getPluralsCount()
Returns the number of plural string

Returns:
the element count

getQuantity

public java.lang.String getQuantity(int index)
Returns the quantity at the given index, such as "one", "two", "few", etc.

Parameters:
index - the index, which must be in the range [0..getPluralsCount()].
Returns:
the corresponding quantity string

getValue

public java.lang.String getValue(int index)
Returns the string element at the given index position.

Parameters:
index - index, which must be in the range [0..getPluralsCount()].
Returns:
the corresponding element

getValue

public java.lang.String getValue(java.lang.String quantity)
Returns the string element for the given quantity

Parameters:
quantity - the quantity string, such as "one", "two", "few", etc.
Returns:
the corresponding string value, or null if not defined

getValue

public java.lang.String getValue()
Description copied from class: ResourceValue
Returns the value of the resource, as defined in the XML. This can be null

Specified by:
getValue in interface IResourceValue
Overrides:
getValue in class ResourceValue