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

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.ArrayResourceValue
All Implemented Interfaces:
IResourceValue, java.lang.Iterable<java.lang.String>

public class ArrayResourceValue
extends ResourceValue
implements java.lang.Iterable<java.lang.String>

Represents an android array resource with a name and a list of children ResourceValue items, one for array element.


Field Summary
 
Fields inherited from class com.android.ide.common.rendering.api.ResourceValue
mValue
 
Constructor Summary
ArrayResourceValue(java.lang.String name, boolean isFramework)
          Constructs a new ArrayResourceValue
 
Method Summary
 void addElement(java.lang.String value)
          Adds an element into the array
protected  int getDefaultIndex()
          Returns the index of the element to pick by default if a client of layoutlib asks for the getValue() rather than the more specific ArrayResourceValue iteration methods
 java.lang.String getElement(int index)
          Returns the array element value at the given index position.
 int getElementCount()
          Returns the number of elements in this array
 java.lang.String getValue()
          Returns the value of the resource, as defined in the XML.
 java.util.Iterator<java.lang.String> iterator()
          Returns an iterator over the resource values
 
Methods inherited from class com.android.ide.common.rendering.api.ResourceValue
equals, 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

ArrayResourceValue

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

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

addElement

public void addElement(java.lang.String value)
Adds an element into the array


getElementCount

public int getElementCount()
Returns the number of elements in this array

Returns:
the element count

getElement

public java.lang.String getElement(int index)
Returns the array element value at the given index position.

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

iterator

public java.util.Iterator<java.lang.String> iterator()
Returns an iterator over the resource values

Specified by:
iterator in interface java.lang.Iterable<java.lang.String>

getDefaultIndex

protected int getDefaultIndex()
Returns the index of the element to pick by default if a client of layoutlib asks for the getValue() rather than the more specific ArrayResourceValue iteration methods


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