T - The type of the values in the selectorpublic final class DelTemplateSelector<T> extends Object
This object allows selection logic to be shared between both tofu and jbcsrc which use
different runtime representations for templates, without needing to have hard dependencies on
those runtime representations. For example, tofu uses TemplateDelegateNode and jbcsrc
uses CompiledTemplate.
This logic should be kept in sync with the JS and Python runtime logic. See the JS
soy.$$getDelegateFn and soy.$$registerDelegateFn methods.
| Modifier and Type | Class and Description |
|---|---|
static class |
DelTemplateSelector.Builder<T>
A Builder for DelTemplateSelector.
|
| Modifier and Type | Method and Description |
|---|---|
com.google.common.collect.ImmutableListMultimap<String,T> |
delTemplateNameToValues()
Returns a multimap from deltemplate name to every member (disregarding variant).
|
boolean |
hasDelTemplateNamed(String delTemplateName) |
T |
selectTemplate(String delTemplateName,
String variant,
com.google.common.base.Predicate<String> activeDelPackageSelector)
Returns an active delegate for the given name, variant and active packages.
|
public com.google.common.collect.ImmutableListMultimap<String,T> delTemplateNameToValues()
This is useful for compiler passes that need to validate all members of deltemplate group.
public boolean hasDelTemplateNamed(String delTemplateName)
@Nullable public T selectTemplate(String delTemplateName, String variant, com.google.common.base.Predicate<String> activeDelPackageSelector)
variant the we fallback to a non variant lookup. Finally, we
return null if no such template can be found.
See soy.$$getDelegateFn for the JS version