public final class SoyListData extends CollectionData implements Iterable<SoyData>, SoyList
| Constructor and Description |
|---|
SoyListData() |
SoyListData(Iterable<?> data)
Constructor that initializes this SoyListData from an existing list.
|
SoyListData(Object... values)
Constructor that initializes this SoyListData with the given elements.
|
| Modifier and Type | Method and Description |
|---|---|
void |
add(boolean value)
Adds a data value.
|
void |
add(double value)
Adds a data value.
|
void |
add(int value)
Adds a data value.
|
void |
add(long value)
Adds a data value.
|
void |
add(Object... values)
Convenience function to add multiple values in one call.
|
void |
add(SoyData value)
Adds a data value.
|
void |
add(String value)
Adds a data value.
|
List<? extends SoyValueProvider> |
asJavaList()
Gets a Java list of all value providers in this SoyList.
|
List<SoyData> |
asList()
Important: Please treat this method as superpackage-private.
|
List<? extends SoyValue> |
asResolvedJavaList()
Gets a Java list all values in this SoyList.
|
boolean |
coerceToBoolean()
Coerces this value into a boolean.
|
String |
coerceToString()
Coerces this value into a string.
|
boolean |
equals(Object other)
Compares this value against another for equality in the sense of the '==' operator of Soy.
|
SoyData |
get(int index)
Gets the data value at a given index.
|
boolean |
getBoolean(int index)
Precondition: The specified index contains a boolean.
|
double |
getFloat(int index)
Precondition: The specified index contains a float.
|
int |
getInteger(int index)
Precondition: The specified index contains an integer.
|
SoyValue |
getItem(SoyValue key)
Gets an item value of this SoyMap.
|
int |
getItemCnt()
Gets the number of items in this SoyMap.
|
Iterable<? extends SoyValue> |
getItemKeys()
Gets an iterable over all item keys in this SoyMap.
|
SoyValueProvider |
getItemProvider(SoyValue key)
Gets a provider of an item value of this SoyMap.
|
SoyListData |
getListData(int index)
Precondition: The specified index contains a SoyListData object.
|
long |
getLong(int index)
Precondition: The specified index contains a long.
|
SoyMapData |
getMapData(int index)
Precondition: The specified index contains a SoyMapData object.
|
SoyValueProvider |
getProvider(int index)
Gets a provider of a value of this SoyList.
|
SoyData |
getSingle(String key)
Important: Do not use outside of Soy code (treat as superpackage-private).
|
String |
getString(int index)
Precondition: The specified index contains a string.
|
int |
hashCode() |
boolean |
hasItem(SoyValue key)
Checks whether this SoyMap has an item with the given key.
|
Iterator<SoyData> |
iterator() |
int |
length()
Gets the length of this list.
|
void |
putSingle(String key,
SoyData value)
Important: Do not use outside of Soy code (treat as superpackage-private).
|
void |
remove(int index)
Removes the data value at a given index.
|
void |
removeSingle(String key)
Important: Do not use outside of Soy code (treat as superpackage-private).
|
void |
render(LoggingAdvisingAppendable appendable)
Renders this value to the given appendable.
|
void |
set(int index,
boolean value)
Sets a data value at a given index.
|
void |
set(int index,
double value)
Sets a data value at a given index.
|
void |
set(int index,
int value)
Sets a data value at a given index.
|
void |
set(int index,
SoyData value)
Sets a data value at a given index.
|
void |
set(int index,
String value)
Sets a data value at a given index.
|
String |
toString() |
ensureValidValue, get, getBoolean, getFloat, getInteger, getListData, getLong, getMapData, getString, put, put, put, put, put, put, put, removecreateFromExistingDatabooleanValue, floatValue, integerValue, longValue, numberValue, render, renderAndResolve, resolve, status, stringValueclone, finalize, getClass, notify, notifyAll, wait, wait, waitforEach, spliteratorbooleanValue, floatValue, integerValue, longValue, numberValue, render, stringValuerenderAndResolve, resolve, statuspublic SoyListData()
public SoyListData(Iterable<?> data)
data - The initial data in an existing Iterable.public SoyListData(Object... values)
values - The initial data to add.public List<SoyData> asList()
Returns a view of this SoyListData object as a List.
public String toString()
This method should only be used for debugging purposes.
public void render(LoggingAdvisingAppendable appendable) throws IOException
SoyValueThis should behave identically to appendable.append(coerceToString()) but is
provided separately to allow more incremental approaches.
render in interface SoyValueappendable - The appendable to render to.IOExceptionpublic boolean coerceToBoolean()
A list is always truthy.
coerceToBoolean in interface SoyValuepublic String coerceToString()
SoyValuecoerceToString in interface SoyValuepublic final boolean equals(Object other)
SoyValueequals in interface SoyValueequals in class SoyAbstractValueother - The other value to compare against.public int length()
public void add(Object... values)
values - The data to add.public void add(SoyData value)
value - The data to add.public void add(boolean value)
value - The data to add.public void add(int value)
value - The data to add.public void add(long value)
value - The data to add.public void add(double value)
value - The data to add.public void add(String value)
value - The data to add.public void set(int index,
SoyData value)
index - The index.value - The data to set.public void set(int index,
boolean value)
index - The index.value - The data to set.public void set(int index,
int value)
index - The index.value - The data to set.public void set(int index,
double value)
index - The index.value - The data to set.public void set(int index,
String value)
index - The index.value - The data to set.public void remove(int index)
index - The index.public SoyData get(int index)
public SoyMapData getMapData(int index)
index - The index.public SoyListData getListData(int index)
index - The index.public boolean getBoolean(int index)
index - The index.public int getInteger(int index)
index - The index.public long getLong(int index)
index - The index.public double getFloat(int index)
index - The index.public String getString(int index)
index - The index.public void putSingle(String key, SoyData value)
Puts data into this data object at the specified key.
putSingle in class CollectionDatakey - An individual key.value - The data to put at the specified key.public void removeSingle(String key)
Removes the data at the specified key.
removeSingle in class CollectionDatakey - An individual key.public SoyData getSingle(String key)
Gets the data at the specified key.
getSingle in class CollectionDatakey - An individual key.@Nonnull public List<? extends SoyValueProvider> asJavaList()
SoyListasJavaList in interface SoyList@Nonnull public List<? extends SoyValue> asResolvedJavaList()
SoyListasResolvedJavaList in interface SoyListpublic SoyValueProvider getProvider(int index)
SoyListgetProvider in interface SoyListindex - The index to get.public int getItemCnt()
SoyLegacyObjectMapgetItemCnt in interface SoyLegacyObjectMap@Nonnull public Iterable<? extends SoyValue> getItemKeys()
SoyLegacyObjectMapImportant: Iteration order is undefined.
getItemKeys in interface SoyLegacyObjectMappublic boolean hasItem(SoyValue key)
SoyLegacyObjectMaphasItem in interface SoyLegacyObjectMapkey - The item key to check.public SoyValue getItem(SoyValue key)
SoyLegacyObjectMapgetItem in interface SoyLegacyObjectMapkey - The item key to get.public SoyValueProvider getItemProvider(SoyValue key)
SoyLegacyObjectMapgetItemProvider in interface SoyLegacyObjectMapkey - The item key to get.