public abstract class ToStringCompiler extends ToItemCompiler
Constructor and Description |
---|
ToStringCompiler() |
Modifier and Type | Method and 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.
|
void |
compileToPrimitive(CompilerService compiler,
Expression expression,
java.lang.Class<?> requiredClass,
OnEmpty onEmpty)
Generate bytecode to evaluate the expression leaving a plain Java value on the stack.
|
void |
compileToString(CompilerService compiler,
Expression expression,
OnEmpty onEmpty) |
void |
compileToUnicodeString(CompilerService compiler,
Expression expression,
OnEmpty onEmpty) |
compileToBoolean, compileToIterator, compileToPush, treatAsEmptyIfFirstArgumentIsEmpty
allocateStatic, compileItemFromInt, generateMethod, handleEmptyStringResult, printStackTop, verify, visitAnnotation, visitLineNumber
public final void compileToItem(CompilerService compiler, Expression expression) throws CannotCompileException
compileToItem
in class ExpressionCompiler
compiler
- the compiler serviceexpression
- the expression to be compiledCannotCompileException
- if the expression cannot be compiled to bytecodeprotected final void compileItemFromString(CompilerService compiler, Expression expression) throws CannotCompileException
compiler
- the compiler serviceexpression
- the expression to be compiledCannotCompileException
- if the expression cannot be compiled to bytecodepublic void compileToPrimitive(CompilerService compiler, Expression expression, java.lang.Class<?> requiredClass, OnEmpty onEmpty) throws CannotCompileException
ExpressionCompiler
compileToPrimitive
in class ExpressionCompiler
compiler
- the compiler serviceexpression
- the expression to be compiledrequiredClass
- the class of the Java value that is to be left on the stack if the generated code
exits normally. This must be one of Integer.TYPE, Double.TYPE, Float.TYPE, BigDecimal.class,
String.class, UnicodeString.class.onEmpty
- defines the action to be taken if the expression evaluates to the empty sequence.
May be null if the expression is known statically not to evaluate to an empty sequence. If the return
class is a primitive type (double, float, etc) this must be an instance of OnEmpty.UnwindAndJump
CannotCompileException
- if the expression cannot be compiled to bytecodepublic void compileToUnicodeString(CompilerService compiler, Expression expression, OnEmpty onEmpty) throws CannotCompileException
CannotCompileException
public void compileToString(CompilerService compiler, Expression expression, OnEmpty onEmpty) throws CannotCompileException
CannotCompileException
Copyright (c) 2004-2022 Saxonica Limited. All rights reserved.