public final class SoyValueConverter extends Object
IMPORTANT: This class is partially open for public use. Specifically, you may use the method
convert(java.lang.Object) and the static fields. But do not use the new* methods. Consider the
new* methods internal to Soy, since we haven't yet decided whether or not to make them
directly available.
| Modifier and Type | Field and Description |
|---|---|
static SoyDict |
EMPTY_DICT
An immutable empty dict.
|
static SoyList |
EMPTY_LIST
An immutable empty list.
|
static SoyMapImpl |
EMPTY_MAP
An immutable empty map.
|
static SoyValueConverter |
INSTANCE |
static SoyValueConverter |
UNCUSTOMIZED_INSTANCE
Static instance of this class that does not include any custom value converters.
|
| Modifier and Type | Method and Description |
|---|---|
SoyValueProvider |
convert(Object obj)
Converts a Java object into an equivalent SoyValueProvider.
|
static Object |
markAsSoyMap(Map<?,?> delegate)
Signals to the Java rendering API that the wrapped
java.util.Map represents a Soy
map, and not a legacy_object_map or record. |
SoyDict |
newDictFromMap(Map<String,?> javaStringMap)
Creates a Soy dictionary from a Java string map.
|
SoyEasyList |
newEasyListFromList(SoyList list)
Deprecated.
|
public static final SoyValueConverter UNCUSTOMIZED_INSTANCE
public static final SoyValueConverter INSTANCE
public static final SoyDict EMPTY_DICT
public static final SoyList EMPTY_LIST
public static final SoyMapImpl EMPTY_MAP
public SoyDict newDictFromMap(Map<String,?> javaStringMap)
public static Object markAsSoyMap(Map<?,?> delegate)
java.util.Map represents a Soy
map, and not a legacy_object_map or record. In particular, this allows the map
to contain non-string keys. See discussion in DictImpl.
If you want to use non-string keys in a map in Soy, you need to do three things:
legacy_object_map to map
markAsSoyMap
@Deprecated public SoyEasyList newEasyListFromList(SoyList list)
Creates a new SoyEasyList initialized from a SoyList.
list - The list of initial values.@Nonnull public SoyValueProvider convert(@Nullable Object obj)
obj - The object to convert.SoyDataException - If the given object cannot be converted.