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 |
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.
|
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.
|
int |
hashCode() |
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(LoggingAdvisingAppendable appendable)
Renders this value to the given appendable.
|
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, waitbooleanValue, floatValue, integerValue, longValue, numberValue, render, 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()
Returns a view of this SoyMapData object as a Map.
public Set<String> getKeys()
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 map 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 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 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()
SoyLegacyObjectMapgetItemCnt in interface SoyLegacyObjectMap@Nonnull public Iterable<StringData> 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.