Package com.saxonica.ee.bytecode

## Class ToStringCompiler

- java.lang.Object
- - com.saxonica.ee.bytecode.ExpressionCompiler
  - - com.saxonica.ee.bytecode.ToItemCompiler
    - - com.saxonica.ee.bytecode.ToStringCompiler

- Direct Known Subclasses:
    `ConcatCompiler`, `ForceCaseCompiler`, `GenerateIdCompiler`, `NodePropertyCompiler`, `NormalizeSpaceCompiler`, `StringFnCompiler`, `StringJoinCompiler`, `SubstringAfterCompiler`, `SubstringBeforeCompiler`, `TranslateCompiler`

      public abstract class ToStringCompiler
      extends ToItemCompiler

  Generate bytecode for evaluation of expressions that return a single string (or an empty sequence)

- - ### Constructor Summary

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

  - ### Method Summary

    All Methods Instance Methods Concrete Methods
    Modifier and Type | Method | Description
    --- | --- | ---
    `protected void` | `compileItemFromString​(CompilerService compiler, Expression expression)` | Helper method to implement compileFromItem when the class implements compileToPrimitive
    `void` | `compileToItem​(CompilerService compiler, Expression expression)` | Generate bytecode to evaluate the expression as an Item Precondition: none.

    - ### Methods inherited from class com.saxonica.ee.bytecode.ToItemCompiler

      `compileToBoolean, compileToIterator, compileToPush, returnZeroLengthStringIfNull`

    - ### Methods inherited from class com.saxonica.ee.bytecode.ExpressionCompiler

      `allocateStatic, compileItemFromInt, compileToPrimitive, generateMethod, handleEmptyStringResult, printStackTop, verify, visitAnnotation, visitLineNumber`

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

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

- - ### Constructor Detail

    - #### ToStringCompiler

          public ToStringCompiler()

  - ### Method Detail

    - #### compileToItem

          public final void compileToItem​(CompilerService compiler,
                                          Expression expression)
                                   throws CannotCompileException

      Generate bytecode to evaluate the expression as an Item Precondition: none. Postcondition: at execution time, the stack contains either an item (the result of the expression), or null (representing an empty sequence).
      Specified by:
        `compileToItem` in class `ExpressionCompiler`
      Parameters:
        `compiler` - the compiler service
        `expression` - the expression to be compiled
      Throws:
        `CannotCompileException` - if the expression cannot be compiled to bytecode

    - #### compileItemFromString

          protected final void compileItemFromString​(CompilerService compiler,
                                                     Expression expression)
                                              throws CannotCompileException

      Helper method to implement compileFromItem when the class implements compileToPrimitive
      Parameters:
        `compiler` - the compiler service
        `expression` - the expression to be compiled
      Throws:
        `CannotCompileException` - if the expression cannot be compiled to bytecode