public final class TemplateRegistry extends Object
Important: Do not use outside of Soy code (treat as superpackage-private).
| Modifier and Type | Class and Description |
|---|---|
static class |
TemplateRegistry.DelegateTemplateConflictException
Exception thrown when there's no unique highest-priority active delegate template at render
time.
|
static class |
TemplateRegistry.DelegateTemplateDivision
Represents a set of delegate templates with the same key (name and variant) and same priority.
|
| Constructor and Description |
|---|
TemplateRegistry(SoyFileSetNode soyTree)
Constructor.
|
| Modifier and Type | Method and Description |
|---|---|
TemplateBasicNode |
getBasicTemplate(String templateName)
Retrieves a basic template given the template name.
|
Map<String,TemplateBasicNode> |
getBasicTemplatesMap()
Returns a map from basic template name to node.
|
Set<TemplateRegistry.DelegateTemplateDivision> |
getDelTemplateDivisionsForAllVariants(String delTemplateName)
Retrieves the set of
DelegateTemplateDivisions for all variants of a given a delegate
template name. |
Set<TemplateDelegateNode.DelTemplateKey> |
getDelTemplateKeysForAllVariants(String delTemplateName)
Retrieves the set of key (name and variant) strings for all variants of a given delegate
template name.
|
Map<String,Set<TemplateDelegateNode.DelTemplateKey>> |
getDelTemplateNameToKeysMap()
Returns a map from delegate template name to set of keys.
|
Map<TemplateDelegateNode.DelTemplateKey,List<TemplateRegistry.DelegateTemplateDivision>> |
getDelTemplatesMap()
Returns a map from delegate template key (name and variant) to list of
DelegateTemplateDivisions, where each list is sorted in descending priority order. |
TemplateDelegateNode |
selectDelTemplate(TemplateDelegateNode.DelTemplateKey delTemplateKey,
Set<String> activeDelPackageNames)
Selects a delegate template based on the rendering rules, given the delegate template key (name
and variant) and the set of active delegate package names.
|
public TemplateRegistry(SoyFileSetNode soyTree)
soyTree - The Soy tree from which to build a template registry.public Map<String,TemplateBasicNode> getBasicTemplatesMap()
public TemplateBasicNode getBasicTemplate(String templateName)
templateName - The basic template name to retrieve.public Map<String,Set<TemplateDelegateNode.DelTemplateKey>> getDelTemplateNameToKeysMap()
public Map<TemplateDelegateNode.DelTemplateKey,List<TemplateRegistry.DelegateTemplateDivision>> getDelTemplatesMap()
DelegateTemplateDivisions, where each list is sorted in descending priority order.public Set<TemplateDelegateNode.DelTemplateKey> getDelTemplateKeysForAllVariants(String delTemplateName)
delTemplateName - The delegate template name to retrieve.public Set<TemplateRegistry.DelegateTemplateDivision> getDelTemplateDivisionsForAllVariants(String delTemplateName)
DelegateTemplateDivisions for all variants of a given a delegate
template name.delTemplateName - The delegate template name to retrieve.DelegateTemplateDivisions for all variants.public TemplateDelegateNode selectDelTemplate(TemplateDelegateNode.DelTemplateKey delTemplateKey, Set<String> activeDelPackageNames) throws TemplateRegistry.DelegateTemplateConflictException
delTemplateKey - The delegate template key (name and variant) to select an implementation
for.activeDelPackageNames - The set of active delegate package names.TemplateRegistry.DelegateTemplateConflictException - If there are two or more active implementations with
equal priority (unable to select one over the other).