public class SoyMapData extends CollectionData implements SoyDict
Important: Even though this class is not marked 'final', do not extend this class.
| Constructor and Description |
|---|
SoyMapData() |
SoyMapData(Map<String,?> data)
Constructor that initializes this SoyMapData from an existing map.
|
SoyMapData(Object... data)
Constructor that directly takes the keys/values as parameters.
|
| Modifier and Type | Method and Description |
|---|---|
Map<String,? extends SoyValueProvider> |
asJavaStringMap()
Gets a Java map of all items in this SoyDict, where mappings are string to value provider.
|
Map<String,SoyData> |
asMap()
Important: Please treat this method as superpackage-private.
|
Map<String,? extends SoyValue> |
asResolvedJavaStringMap()
Gets a Java map of all items in this SoyDict, where mappings are string to value.
|
boolean |
equals(Object other)
Compares this value against another for equality in the sense of the '==' operator of Soy.
|
SoyValue |
getField(String name)
Gets a field value of this SoyRecord.
|
SoyValueProvider |
getFieldProvider(String name)
Gets a provider of a field value of this SoyRecord.
|
SoyValue |
getItem(SoyValue key)
Gets an item value of this SoyMap.
|
int |
getItemCnt()
Gets the number of items in this SoyMap.
|
Iterable<StringData> |
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.
|
Set<String> |
getKeys()
Gets the keys in this map data.
|
SoyData |
getSingle(String key)
Important: Do not use outside of Soy code (treat as superpackage-private).
|
boolean |
hasField(String name)
Checks whether this SoyRecord has a field of the given name.
|
boolean |
hasItem(SoyValue key)
Checks whether this SoyMap has an item with the given key.
|
void |
putSingle(String key,
SoyData value)
Important: Do not use outside of Soy code (treat as superpackage-private).
|
void |
removeSingle(String key)
Important: Do not use outside of Soy code (treat as superpackage-private).
|
void |
render(Appendable appendable)
Renders this value to the given appendable.
|
boolean |
toBoolean()
Deprecated.
|
String |
toString()
This was a required method in the old SoyData interface.
|
ensureValidValue, get, getBoolean, getFloat, getInteger, getListData, getLong, getMapData, getString, put, put, put, put, put, put, put, removecoerceToBoolean, coerceToString, createFromExistingDatabooleanValue, floatValue, integerValue, longValue, numberValue, renderAndResolve, resolve, status, stringValueclone, finalize, getClass, hashCode, notify, notifyAll, wait, wait, waitbooleanValue, coerceToBoolean, coerceToString, floatValue, integerValue, longValue, numberValue, stringValuerenderAndResolve, resolve, statuspublic SoyMapData()
public SoyMapData(Map<String,?> data)
data - The initial data in an existing map.public SoyMapData(Object... data)
data - The initial data, with alternating keys/values.public Map<String,SoyData> asMap()
public Set<String> getKeys()
public String toString()
This method should only be used for debugging purposes.
public void render(Appendable 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.IOException@Deprecated public boolean toBoolean()
A map is always truthy.
public boolean equals(Object other)
SoyValueequals in interface SoyValueequals in class SoyAbstractValueother - The other value to compare against.public void putSingle(String key, SoyData value)
putSingle in class CollectionDatakey - An individual key.value - The data to put at the specified key.public void removeSingle(String key)
removeSingle in class CollectionDatakey - An individual key.public SoyData getSingle(String key)
getSingle in class CollectionDatakey - An individual key.@Nonnull public Map<String,? extends SoyValueProvider> asJavaStringMap()
SoyDictasJavaStringMap in interface SoyDict@Nonnull public Map<String,? extends SoyValue> asResolvedJavaStringMap()
SoyDictasResolvedJavaStringMap in interface SoyDictpublic boolean hasField(String name)
SoyRecordpublic SoyValue getField(String name)
SoyRecordpublic SoyValueProvider getFieldProvider(String name)
SoyRecordgetFieldProvider in interface SoyRecordname - The field name to get.public int getItemCnt()
SoyMapgetItemCnt in interface SoyMap@Nonnull public Iterable<StringData> getItemKeys()
SoyMapgetItemKeys in interface SoyMappublic boolean hasItem(SoyValue key)
SoyMappublic SoyValue getItem(SoyValue key)
SoyMappublic SoyValueProvider getItemProvider(SoyValue key)
SoyMapgetItemProvider in interface SoyMapkey - The item key to get.