org.apache.xalan.templates

## Class VarNameCollector

- java.lang.Object
- - org.apache.xpath.XPathVisitor
  - - org.apache.xalan.templates.VarNameCollector

-     public class VarNameCollector
      extends XPathVisitor

  This class visits variable refs in an XPath and collects their QNames.

- - ### Constructor Summary

    Constructors
    Constructor and Description
    `VarNameCollector()`

  - ### Method Summary

    All Methods Instance Methods Concrete Methods
    Modifier and Type | Method and Description
    --- | ---
    `int` | `getVarCount()` Get the number of variable references that were collected.
    `void` | `reset()` Reset the list for a fresh visitation and collection.
    `boolean` | `visitVariableRef(ExpressionOwner owner, Variable var)` Visit a variable reference.

    - ### Methods inherited from class org.apache.xpath.XPathVisitor

      `visitBinaryOperation, visitFunction, visitLocationPath, visitMatchPattern, visitNumberLiteral, visitPredicate, visitStep, visitStringLiteral, visitUnaryOperation, visitUnionPath, visitUnionPattern`

    - ### Methods inherited from class java.lang.Object

      `equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

- - ### Constructor Detail

    - #### VarNameCollector

          public VarNameCollector()

  - ### Method Detail

    - #### reset

          public void reset()

      Reset the list for a fresh visitation and collection.

    - #### getVarCount

          public int getVarCount()

      Get the number of variable references that were collected.
      Returns:
        the size of the list.

    - #### visitVariableRef

          public boolean visitVariableRef(ExpressionOwner owner,
                                          Variable var)

      Visit a variable reference.
      Overrides:
        `visitVariableRef` in class `XPathVisitor`
      Parameters:
        `owner` - The owner of the expression, to which the expression can be reset if rewriting takes place.
        `var` - The variable reference object.
      Returns:
        true if the sub expressions should be traversed.

Copyright © 2023 Apache XML Project. All Rights Reserved.