Package net.sf.saxon.trace

## Class TraceCodeInjector

- java.lang.Object
- - net.sf.saxon.trace.TraceCodeInjector

- All Implemented Interfaces:
    `CodeInjector`
  Direct Known Subclasses:
    `TimingCodeInjector`, `XQueryTraceCodeInjector`, `XSLTTraceCodeInjector`

      public class TraceCodeInjector
      extends java.lang.Object
      implements CodeInjector

  A code injector that wraps every expression (other than a literal) in a TraceExpression, which causes a TraceListener to be notified when the expression is evaluated

- - ### Constructor Summary

    Constructors
    Constructor | Description
    --- | ---
    `TraceCodeInjector()` |

  - ### Method Summary

    All Methods Instance Methods Concrete Methods
    Modifier and Type | Method | Description
    --- | --- | ---
    `Expression` | `inject​(Expression exp)` | Process an expression.
    `Clause` | `injectClause​(FLWORExpression expression, Clause clause)` | Insert a tracing or monitoring clause into the pipeline of clauses that evaluates a FLWOR expression
    `protected boolean` | `isApplicable​(Expression exp)` |
    `void` | `process​(TraceableComponent component)` | Process a component such as a function, template, or global variable.

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

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

- - ### Constructor Detail

    - #### TraceCodeInjector

          public TraceCodeInjector()

  - ### Method Detail

    - #### inject

          public Expression inject​(Expression exp)

      Description copied from interface: `CodeInjector`
      Process an expression.
      Specified by:
        `inject` in interface `CodeInjector`
      Parameters:
        `exp` - the expression to be processed
      Returns:
        a new expression. Possibly the original expression unchanged; possibly a wrapper expression (such as a `TraceExpression`; possibly a modified version of the original expression. The default implementation returns the supplied expression unchanged.

    - #### isApplicable

          protected boolean isApplicable​(Expression exp)

    - #### process

          public void process​(TraceableComponent component)

      Description copied from interface: `CodeInjector`
      Process a component such as a function, template, or global variable. The default implementation does nothing.
      Specified by:
        `process` in interface `CodeInjector`
      Parameters:
        `component` - the component to be processed

    - #### injectClause

          public Clause injectClause​(FLWORExpression expression,
                                     Clause clause)

      Insert a tracing or monitoring clause into the pipeline of clauses that evaluates a FLWOR expression
      Specified by:
        `injectClause` in interface `CodeInjector`
      Parameters:
        `expression` - the containing FLWOR expression
        `clause` - the clause whose execution is being monitored
      Returns:
        an injected clause; or the original. The default implementation returns the original clause unchanged.