## net.sf.saxon.expr
Interface CodeGeneratorService

All Known Implementing Classes:
  CompilerService

    public interface CodeGeneratorService

Method Summary
`java.lang.String` `cast(java.lang.String variable, java.lang.Class target)` Generate a Java cast unless it is known to be unnecessary.
`java.lang.String` `getContextVariableName()` Get the name of the Java variable currently bound to the dynamic XPathContext object

Method Detail

### getContextVariableName

    java.lang.String getContextVariableName()

  Get the name of the Java variable currently bound to the dynamic XPathContext object

  Returns:
    the Java variable name

### cast

    java.lang.String cast(java.lang.String variable,
                          java.lang.Class target)

  Generate a Java cast unless it is known to be unnecessary.

  Parameters:
    `variable` - the name of the variable that possibly needs to be cast
    `target` - the required type for the expression where the variable is being used
  Returns:
    either the variable name on its own, if no cast is required, or a string in the form "((class)variable)" if casting is needed.

Copyright (c) Saxonica Limited. All rights reserved.