public final class SoyFileNode extends AbstractParentSoyNode<TemplateNode> implements SoyNode.SplitLevelTopNode<TemplateNode>
Important: Do not use outside of Soy code (treat as superpackage-private).
SoyNode.BlockCommandNode, SoyNode.BlockNode, SoyNode.CommandNode, SoyNode.ConditionalBlockNode, SoyNode.ExprHolderNode, SoyNode.Kind, SoyNode.LocalVarBlockNode, SoyNode.LocalVarInlineNode, SoyNode.LocalVarNode, SoyNode.LoopNode, SoyNode.MsgBlockNode, SoyNode.MsgPlaceholderInitialNode, SoyNode.MsgSubstUnitNode, SoyNode.ParentSoyNode<N extends SoyNode>, SoyNode.RenderUnitNode, SoyNode.SplitLevelTopNode<N extends SoyNode>, SoyNode.StandaloneNode, SoyNode.StatementNode| Modifier and Type | Field and Description |
|---|---|
static com.google.common.base.Predicate<SoyFileNode> |
MATCH_SRC_FILENODE |
SPACES| Constructor and Description |
|---|
SoyFileNode(int id,
String filePath,
SoyFileKind soyFileKind,
String delpackageCmdText,
String namespaceCmdText,
List<String> aliasCmdTexts) |
| Modifier and Type | Method and Description |
|---|---|
SoyFileNode |
clone()
Copies this node.
|
com.google.common.collect.ImmutableMap<String,String> |
getAliasToNamespaceMap()
Returns the map from aliases to namespaces for this file.
|
String |
getCssBaseNamespace()
Returns the CSS base namespace for this file (usable in any template in this file).
|
AutoescapeMode |
getDefaultAutoescapeMode()
Returns the default autoescaping mode for contained templates.
|
String |
getDelPackageName()
Returns the name of the containing delegate package, or null if none.
|
String |
getFileName()
Returns this Soy file's name (null if not supplied).
|
String |
getFilePath()
Returns the path to the source Soy file ("unknown" if not supplied).
|
SoyNode.Kind |
getKind()
Returns this node's kind (corresponding to this node's specific type).
|
String |
getNamespace()
Returns this Soy file's namespace, or null if syntax version V1.
|
SoyFileSetNode |
getParent()
Gets this node's parent.
|
com.google.common.collect.ImmutableList<String> |
getRequiredCssNamespaces()
Returns the CSS namespaces required by this file (usable in any template in this file).
|
SoyFileKind |
getSoyFileKind()
Returns the kind of this Soy file.
|
String |
toSourceString()
Builds a Soy source string that could be the source for this node.
|
addChild, addChild, addChildren, addChildren, appendSourceStringForChildren, appendTreeStringForChildren, clearChildren, getChild, getChildIndex, getChildren, numChildren, removeChild, removeChild, replaceChild, replaceChild, toTreeStringgetId, getSourceLocation, setId, toStringcouldHaveSyntaxVersionAtLeast, getNearestAncestor, getSyntaxVersionBound, hasAncestor, maybeSetSyntaxVersionBound, setParentequals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, waitaddChild, addChild, addChildren, addChildren, appendSourceStringForChildren, appendTreeStringForChildren, clearChildren, getChild, getChildIndex, getChildren, numChildren, removeChild, removeChild, replaceChild, replaceChildcouldHaveSyntaxVersionAtLeast, getNearestAncestor, getSourceLocation, getSyntaxVersionBound, hasAncestor, maybeSetSyntaxVersionBound, setParent, toTreeStringpublic static final com.google.common.base.Predicate<SoyFileNode> MATCH_SRC_FILENODE
public SoyFileNode(int id,
String filePath,
SoyFileKind soyFileKind,
@Nullable
String delpackageCmdText,
@Nullable
String namespaceCmdText,
@Nullable
List<String> aliasCmdTexts)
throws SoySyntaxException
id - The id for this node.filePath - The path to the Soy source file.soyFileKind - The kind of this Soy file.delpackageCmdText - This Soy file's delegate package, or null if none.namespaceCmdText - This Soy file's namespace and attributes. Nullable for backwards
compatibility only.aliasCmdTexts - The command texts of the 'alias' declarations. Allowed to be null.SoySyntaxException - If a syntax error is found.public SoyNode.Kind getKind()
SoyNodepublic SoyFileKind getSoyFileKind()
@Nullable public String getDelPackageName()
@Nullable public String getNamespace()
public AutoescapeMode getDefaultAutoescapeMode()
public com.google.common.collect.ImmutableList<String> getRequiredCssNamespaces()
public String getCssBaseNamespace()
public com.google.common.collect.ImmutableMap<String,String> getAliasToNamespaceMap()
public String getFilePath()
@Nullable public String getFileName()
public String toSourceString()
NodetoSourceString in interface Nodepublic SoyFileSetNode getParent()
Nodepublic SoyFileNode clone()
NodeAll clone() overrides should follow this contract:
{@literal @}Override public T clone() {
return new T(this);
}
NOTE: this means we do not ultimately delegate to Object.clone(), ever.
TODO(lukes): The usecases for a clone method are few and far between. Making the AST nodes immutable (or at least unmodifiable) would be preferable to maintaining our clone() methods.