Skip navigation links
com.google.template.soy.soytree

Class VeLogNode

    • Method Detail

      • getName

        public Identifier getName()
        Returns the name associated with this log statement.
      • getLoggingId

        @Nullable
        public Long getLoggingId()
        Returns the logging id associated with this log statement, or null if it doesn't exist.
      • getConfigExpression

        @Nullable
        public ExprRootNode getConfigExpression()
        Returns a reference to the config expression, if there is one.
      • getLogonlyExpression

        @Nullable
        public ExprRootNode getLogonlyExpression()
        Returns a reference to the config expression, if there is one.
      • getKind

        public SoyNode.Kind getKind()
        Description copied from interface: SoyNode
        Returns this node's kind (corresponding to this node's specific type).
        Specified by:
        getKind in interface SoyNode
      • copy

        public VeLogNode copy(CopyState copyState)
        Description copied from interface: SoyNode
        Copies this node. The copy's parent pointer is set to null.

        All copy() overrides should follow this contract:

        • only leaf classes (in the class hierarchy) should have non-abstract clone methods
        • all leaf classes should be final
        • all leaf copy constructors should be private
        • all clone methods should look exactly like:
          
           {@literal @}Override public T copy(CopyState copyState) {
             return new T(this, copyState);
           }
           
        • all non-leaf copy constructors should be protected

        TODO(lukes): The usecases for a copy method are few and far between. Making the AST nodes immutable (or at least unmodifiable) would be preferable to maintaining our copy() methods.

        Don't clone nodes unless you know what you're doing. The Soy AST is not actually a tree (it contains back edges from variables to their definitions), and naively copying nodes can result in pointers into stale ASTs

        The copied nodes will have the same ids as the original nodes. If you need to copy a subtree with new ids assigned to the copied nodes, use SoyTreeUtils.cloneWithNewIds(T, com.google.template.soy.base.internal.IdGenerator).

        Specified by:
        copy in interface Node
        Specified by:
        copy in interface SoyNode
        Returns:
        A clone of this code.
      • toSourceString

        public String toSourceString()
        Description copied from interface: Node
        Builds a Soy source string that could be the source for this node. Note that this is not the actual original source string, but a (SORT OF, NOT QUITE) canonical equivalent.

        Note: Some nodes do not have a direct mapping to Soy source (such as nodes created during some optimization passes). Thus this method may not always be supported.

        Specified by:
        toSourceString in interface Node
        Returns:
        A Soy string that could be the source for this node.
      • setLoggingId

        public void setLoggingId(long id)
      • numChildren

        public int numChildren()
        Description copied from interface: ParentNode
        Gets the number of children.
        Specified by:
        numChildren in interface ParentNode<N extends SoyNode>
        Returns:
        The number of children.
      • getChild

        public N getChild(int index)
        Description copied from interface: ParentNode
        Gets the child at the given index.
        Specified by:
        getChild in interface ParentNode<N extends SoyNode>
        Parameters:
        index - The index of the child to get.
        Returns:
        The child at the given index.
      • getChildIndex

        public int getChildIndex(Node child)
        Description copied from interface: ParentNode
        Finds the index of the given child.
        Specified by:
        getChildIndex in interface ParentNode<N extends SoyNode>
        Parameters:
        child - The child to find the index of.
        Returns:
        The index of the given child, or -1 if the given child is not a child of this node.
      • getChildren

        public List<N> getChildren()
        Description copied from interface: ParentNode
        Gets the list of children.

        Note: The returned list may not be a copy. Please do not modify the list directly. Instead, use the other methods in this class that are intended for modifying children. Also, if you're iterating over the children list as you're modifying it, then you should first make a copy of the children list to iterate over, in order to avoid ConcurrentModificationException.

        Specified by:
        getChildren in interface ParentNode<N extends SoyNode>
        Returns:
        The list of children.
      • addChild

        public void addChild(N child)
        Description copied from interface: ParentNode
        Adds the given child.
        Specified by:
        addChild in interface ParentNode<N extends SoyNode>
        Parameters:
        child - The child to add.
      • addChild

        public void addChild(int index,
                             N child)
        Description copied from interface: ParentNode
        Adds the given child at the given index (shifting existing children if necessary).
        Specified by:
        addChild in interface ParentNode<N extends SoyNode>
        Parameters:
        index - The index to add the child at.
        child - The child to add.
      • removeChild

        public void removeChild(int index)
        Description copied from interface: ParentNode
        Removes the child at the given index.
        Specified by:
        removeChild in interface ParentNode<N extends SoyNode>
        Parameters:
        index - The index of the child to remove.
      • removeChild

        public void removeChild(N child)
        Description copied from interface: ParentNode
        Removes the given child.
        Specified by:
        removeChild in interface ParentNode<N extends SoyNode>
        Parameters:
        child - The child to remove.
      • replaceChild

        public void replaceChild(int index,
                                 N newChild)
        Description copied from interface: ParentNode
        Replaces the child at the given index with the given new child.
        Specified by:
        replaceChild in interface ParentNode<N extends SoyNode>
        Parameters:
        index - The index of the child to replace.
        newChild - The new child.
      • replaceChild

        public void replaceChild(N currChild,
                                 N newChild)
        Description copied from interface: ParentNode
        Replaces the given current child with the given new child.
        Specified by:
        replaceChild in interface ParentNode<N extends SoyNode>
        Parameters:
        currChild - The current child to be replaced.
        newChild - The new child.
      • addChildren

        public void addChildren(List<? extends N> children)
        Description copied from interface: ParentNode
        Adds the given children.
        Specified by:
        addChildren in interface ParentNode<N extends SoyNode>
        Parameters:
        children - The children to add.
      • addChildren

        public void addChildren(int index,
                                List<? extends N> children)
        Description copied from interface: ParentNode
        Adds the given children at the given index (shifting existing children if necessary).
        Specified by:
        addChildren in interface ParentNode<N extends SoyNode>
        Parameters:
        index - The index to add the children at.
        children - The children to add.
      • appendSourceStringForChildren

        public void appendSourceStringForChildren(StringBuilder sb)
        Description copied from interface: ParentNode
        Appends the source strings for all the children to the given StringBuilder.
        Specified by:
        appendSourceStringForChildren in interface ParentNode<N extends SoyNode>
        Parameters:
        sb - The StringBuilder to which to append the children's source strings.
      • getTagString

        protected String getTagString()
        Returns:
        A Soy tag string that could be the Soy tag for this node. Note that this may not necessarily be the actual original Soy tag, but a (sort of) canonical equivalent.
      • getTagString

        protected final String getTagString(boolean selfEnding)