Package org.apache.sling.scripting.sightly.impl.compiler.optimization

## Class CommandVariableUsage

- java.lang.Object
- - org.apache.sling.scripting.sightly.compiler.commands.AbstractCommandVisitor
  - - org.apache.sling.scripting.sightly.impl.compiler.optimization.CommandVariableUsage

All Implemented Interfaces:
  `CommandVisitor`

    public class CommandVariableUsage
    extends AbstractCommandVisitor

Extracts the variables used in a command

### Constructor Summary

Constructors
`CommandVariableUsage()`

### Method Summary

All Methods Static Methods Instance Methods Concrete Methods
`static List<String>` `extractVariables​(Command command)`
`void` `visit​(Conditional.Start conditionalStart)` Process a `Conditional.Start` command.
`void` `visit​(Loop.Start loopStart)` Process a `Loop.Start` command.
`void` `visit​(OutputVariable outputVariable)` Process a `OutputVariable` command.
`void` `visit​(Procedure.Call procedureCall)` Process a `Procedure.Call` command.
`void` `visit​(VariableBinding.Global globalAssignment)` Process a `VariableBinding.Global` command.
`void` `visit​(VariableBinding.Start variableBindingStart)` Process a `VariableBinding.Start` command.

### Methods inherited from class org.apache.sling.scripting.sightly.compiler.commands.AbstractCommandVisitor

`visit, visit, visit, visit, visit, visit`

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

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

### Constructor Detail

#### CommandVariableUsage

    public CommandVariableUsage()

### Method Detail

#### extractVariables

    public static List<String> extractVariables​(Command command)

#### visit

    public void visit​(Conditional.Start conditionalStart)

Description copied from interface: `CommandVisitor`
Process a `Conditional.Start` command.

Specified by:
  `visit` in interface `CommandVisitor`
Overrides:
  `visit` in class `AbstractCommandVisitor`
Parameters:
  `conditionalStart` - the command

#### visit

    public void visit​(VariableBinding.Start variableBindingStart)

Description copied from interface: `CommandVisitor`
Process a `VariableBinding.Start` command.

Specified by:
  `visit` in interface `CommandVisitor`
Overrides:
  `visit` in class `AbstractCommandVisitor`
Parameters:
  `variableBindingStart` - the command

#### visit

    public void visit​(VariableBinding.Global globalAssignment)

Description copied from interface: `CommandVisitor`
Process a `VariableBinding.Global` command.

Specified by:
  `visit` in interface `CommandVisitor`
Overrides:
  `visit` in class `AbstractCommandVisitor`
Parameters:
  `globalAssignment` - the command

#### visit

    public void visit​(OutputVariable outputVariable)

Description copied from interface: `CommandVisitor`
Process a `OutputVariable` command.

Specified by:
  `visit` in interface `CommandVisitor`
Overrides:
  `visit` in class `AbstractCommandVisitor`
Parameters:
  `outputVariable` - the command

#### visit

    public void visit​(Loop.Start loopStart)

Description copied from interface: `CommandVisitor`
Process a `Loop.Start` command.

Specified by:
  `visit` in interface `CommandVisitor`
Overrides:
  `visit` in class `AbstractCommandVisitor`
Parameters:
  `loopStart` - the command

#### visit

    public void visit​(Procedure.Call procedureCall)

Description copied from interface: `CommandVisitor`
Process a `Procedure.Call` command.

Specified by:
  `visit` in interface `CommandVisitor`
Overrides:
  `visit` in class `AbstractCommandVisitor`
Parameters:
  `procedureCall` - the command