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

## Class SanityChecker

- java.lang.Object
- - org.apache.sling.scripting.sightly.compiler.commands.AbstractCommandVisitor
  - - org.apache.sling.scripting.sightly.impl.compiler.debug.SanityChecker

All Implemented Interfaces:
  `CommandHandler`, `CommandVisitor`

    public final class SanityChecker
    extends AbstractCommandVisitor
    implements CommandHandler

A visitor which checks a stream for correct closing of things

### Method Summary

All Methods Static Methods Instance Methods Concrete Methods
`static void` `attachChecker​(CommandStream commandStream)`
`void` `onDone()` This method is called when the stream has been closed.
`void` `onEmit​(Command command)` Allows this handler to process the `Command` that was just written into the stream to which this handler was attached.
`void` `onError​(String errorMessage)` Allows this handler to process error states.
`void` `visit​(Conditional.End conditionalEnd)` Process a `Conditional.End` command.
`void` `visit​(Conditional.Start conditionalStart)` Process a `Conditional.Start` command.
`void` `visit​(Loop.End loopEnd)` Process a `Loop.End` command.
`void` `visit​(Loop.Start loopStart)` Process a `Loop.Start` command.
`void` `visit​(Procedure.End endProcedure)` Process a `Procedure.End` command.
`void` `visit​(Procedure.Start startProcedure)` Process a `Procedure.Start` command.
`void` `visit​(VariableBinding.End variableBindingEnd)` Process a `VariableBinding.End` 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`

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

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

### Method Detail

#### attachChecker

    public static void attachChecker​(CommandStream commandStream)

#### onEmit

    public void onEmit​(Command command)

Description copied from interface: `CommandHandler`
Allows this handler to process the `Command` that was just written into the stream to which this handler was attached.

Specified by:
  `onEmit` in interface `CommandHandler`
Parameters:
  `command` - the received command

#### onError

    public void onError​(String errorMessage)

Description copied from interface: `CommandHandler`
Allows this handler to process error states.

Specified by:
  `onError` in interface `CommandHandler`
Parameters:
  `errorMessage` - the error's message

#### onDone

    public void onDone()

Description copied from interface: `CommandHandler`
This method is called when the stream has been closed. The contract is that after this call, no other commands or errors will be emitted.

Specified by:
  `onDone` in interface `CommandHandler`

#### 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​(Conditional.End conditionalEnd)

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

Specified by:
  `visit` in interface `CommandVisitor`
Overrides:
  `visit` in class `AbstractCommandVisitor`
Parameters:
  `conditionalEnd` - 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.End variableBindingEnd)

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

Specified by:
  `visit` in interface `CommandVisitor`
Overrides:
  `visit` in class `AbstractCommandVisitor`
Parameters:
  `variableBindingEnd` - 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​(Loop.End loopEnd)

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

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

#### visit

    public void visit​(Procedure.Start startProcedure)

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

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

#### visit

    public void visit​(Procedure.End endProcedure)

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

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