@ParametersAreNonnullByDefault public final class SoyValueHelper extends Object implements SoyValueConverter
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.
Helpers for creating or converting existing data to SoyValue. Replaces the static utilities in
the old class SoyData.| Modifier and Type | Field and Description |
|---|---|
static SoyDict |
EMPTY_DICT
An immutable empty dict.
|
static SoyList |
EMPTY_LIST
An immutable empty list.
|
static SoyValueHelper |
UNCUSTOMIZED_INSTANCE
Static instance of this class that does not include any custom value converters.
|
| Constructor and Description |
|---|
SoyValueHelper() |
| Modifier and Type | Method and Description |
|---|---|
SoyValueProvider |
convert(Object obj)
Converts a Java object into an equivalent SoyValueProvider.
|
SoyEasyDict |
newEasyDict()
IMPORTANT: Do not use this method.
|
SoyEasyDict |
newEasyDict(Object... alternatingKeysAndValues)
IMPORTANT: Do not use this method.
|
SoyEasyDict |
newEasyDictFromDict(SoyDict dict)
IMPORTANT: Do not use this method.
|
SoyEasyDict |
newEasyDictFromJavaStringMap(Map<String,?> javaStringMap)
IMPORTANT: Do not use this method.
|
SoyEasyList |
newEasyList()
IMPORTANT: Do not use this method.
|
SoyEasyList |
newEasyList(Object... values)
IMPORTANT: Do not use this method.
|
SoyEasyList |
newEasyListFromJavaIterable(Iterable<?> javaIterable)
IMPORTANT: Do not use this method.
|
SoyEasyList |
newEasyListFromList(SoyList list)
IMPORTANT: Do not use this method.
|
public static final SoyValueHelper UNCUSTOMIZED_INSTANCE
public static final SoyDict EMPTY_DICT
public static final SoyList EMPTY_LIST
public SoyEasyDict newEasyDict()
public SoyEasyDict newEasyDict(Object... alternatingKeysAndValues)
alternatingKeysAndValues - An alternating list of keys and values.public SoyEasyDict newEasyDictFromDict(SoyDict dict)
dict - The dict of initial items.public SoyEasyDict newEasyDictFromJavaStringMap(Map<String,?> javaStringMap)
javaStringMap - The map of initial items.public SoyEasyList newEasyList()
public SoyEasyList newEasyList(Object... values)
values - A list of values.public SoyEasyList newEasyListFromList(SoyList list)
list - The list of initial values.public SoyEasyList newEasyListFromJavaIterable(Iterable<?> javaIterable)
javaIterable - The Java iterable of initial values.@Nonnull public SoyValueProvider convert(@Nullable Object obj)
convert in interface SoyValueConverterobj - The object to convert.SoyDataException - If the given object cannot be converted.