public final class TemplateRegistry extends Object
Important: Do not use outside of Soy code (treat as superpackage-private).
| Constructor and Description |
|---|
TemplateRegistry(SoyFileSetNode soyTree,
ErrorReporter errorReporter)
Constructor.
|
| Modifier and Type | Method and Description |
|---|---|
com.google.common.collect.ImmutableList<TemplateNode> |
getAllTemplates()
|
TemplateBasicNode |
getBasicTemplate(String templateName)
Retrieves a basic template given the template name.
|
com.google.common.collect.ImmutableMap<String,TemplateBasicNode> |
getBasicTemplatesMap()
Returns a map from basic template name to node.
|
com.google.common.base.Optional<SanitizedContent.ContentKind> |
getCallContentKind(CallNode node)
Gets the content kind that a call results in.
|
DelTemplateSelector<TemplateDelegateNode> |
getDelTemplateSelector()
Returns a multimap from delegate template name to set of keys.
|
TemplateDelegateNode |
selectDelTemplate(TemplateDelegateNode.DelTemplateKey delTemplateKey,
com.google.common.base.Predicate<String> activeDelPackageNameSelector)
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, ErrorReporter errorReporter)
soyTree - The Soy tree from which to build a template registry.public com.google.common.collect.ImmutableMap<String,TemplateBasicNode> getBasicTemplatesMap()
@Nullable public TemplateBasicNode getBasicTemplate(String templateName)
templateName - The basic template name to retrieve.public DelTemplateSelector<TemplateDelegateNode> getDelTemplateSelector()
public com.google.common.collect.ImmutableList<TemplateNode> getAllTemplates()
@Nullable public TemplateDelegateNode selectDelTemplate(TemplateDelegateNode.DelTemplateKey delTemplateKey, com.google.common.base.Predicate<String> activeDelPackageNameSelector)
delTemplateKey - The delegate template key (name and variant) to select an implementation
for.activeDelPackageNameSelector - The predicate for testing whether a given delpackage is
active.IllegalArgumentException - If there are two or more active implementations with equal
priority (unable to select one over the other).public com.google.common.base.Optional<SanitizedContent.ContentKind> getCallContentKind(CallNode node)
node - The CallBasicNode or CallDelegateNode.