public final class SoyToJsVariableMappings extends Object
| Modifier and Type | Method and Description |
|---|---|
static SoyToJsVariableMappings |
forNewTemplate()
Returns a new
SoyToJsVariableMappings suitable for translating an entire template. |
CodeChunk.WithValue |
get(String name)
Returns the JavaScript translation for the Soy variable with the given name,
|
CodeChunk.WithValue |
maybeGet(String name)
Returns the JavaScript translation for the Soy variable with the given name,
or null if no mapping exists for that variable.
|
SoyToJsVariableMappings |
put(String var,
CodeChunk.WithValue translation)
Maps the Soy variable named
name to the given translation. |
public static SoyToJsVariableMappings forNewTemplate()
SoyToJsVariableMappings suitable for translating an entire template.public SoyToJsVariableMappings put(String var, CodeChunk.WithValue translation)
name to the given translation.
Any previous mapping for the variable is lost.
TODO(brndn): this API requires callers to mangle the names they pass in to ensure uniqueness.
Do the mangling internally.public CodeChunk.WithValue get(String name)
@Nullable public CodeChunk.WithValue maybeGet(String name)
forNewTemplate() with the params.