com.saxonica.codegen
Class LiteralCompiler

java.lang.Object
  extended by com.saxonica.codegen.ExpressionCompiler
      extended by com.saxonica.codegen.LiteralCompiler

public class LiteralCompiler
extends ExpressionCompiler

Compile an literal expression to Java code


Constructor Summary
LiteralCompiler(ValueCompiler avc)
           
 
Method Summary
 void compilePush(CompilerService compiler, Expression exp)
          Generate Java code to execute the expression in push mode, that is, code to write events to the current output Receiver
 String compileToCharSequence(CompilerService compiler, Expression exp)
          Compile Java code whose effect is to compute the string value of the expression; the generated code returns a CharSequence.
 String compileToEffectiveBooleanValue(CompilerService compiler, Expression exp, ReturnAction options)
          Generate Java code to evaluate the effective boolean value of the expression
 String compileToItem(CompilerService compiler, Expression exp)
          Generate Java code to evaluate the expression as an Item
 String compileToIterator(CompilerService compiler, Expression exp)
          Generate Java code to evaluate the expression as a SequenceIterator
 String compileToValueRepresentation(CompilerService compiler, Expression expr)
          Generate Java code to evaluate the expression as a ValueRepresentation
 
Methods inherited from class com.saxonica.codegen.ExpressionCompiler
compileAsLoop, getConfiguration, makeExpressionCompiler, setConfiguration
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

LiteralCompiler

public LiteralCompiler(ValueCompiler avc)
Method Detail

compilePush

public void compilePush(CompilerService compiler,
                        Expression exp)
Description copied from class: ExpressionCompiler
Generate Java code to execute the expression in push mode, that is, code to write events to the current output Receiver

Specified by:
compilePush in class ExpressionCompiler
Parameters:
compiler - the compiler service
exp - the expression to be compiled

compileToValueRepresentation

public String compileToValueRepresentation(CompilerService compiler,
                                           Expression expr)
Description copied from class: ExpressionCompiler
Generate Java code to evaluate the expression as a ValueRepresentation

Overrides:
compileToValueRepresentation in class ExpressionCompiler
Parameters:
compiler - the compiler service
expr - the expression to be compiled
Returns:
a simple Java expression (usually the name of a variable that has been declared) which will be of class ValueRepresentation, and which at run-time will hold the value of the expression

compileToItem

public String compileToItem(CompilerService compiler,
                            Expression exp)
Description copied from class: ExpressionCompiler
Generate Java code to evaluate the expression as an Item

Specified by:
compileToItem in class ExpressionCompiler
Parameters:
compiler - the compiler service
exp - the expression to be compiled
Returns:
a simple Java expression (usually the name of a variable that has been declared) which will be of class Item, and which will hold the value of the expression at run-time (or hold null, representing an empty sequence).

compileToIterator

public String compileToIterator(CompilerService compiler,
                                Expression exp)
Description copied from class: ExpressionCompiler
Generate Java code to evaluate the expression as a SequenceIterator

Specified by:
compileToIterator in class ExpressionCompiler
Parameters:
compiler - the compiler service
exp - the XPath expression to be compiled
Returns:
a simple Java expression (usually the name of a variable that has been declared) which will be of class SequenceIterator, and which at run-time will hold an iterator over the the value of the XPath expression

compileToEffectiveBooleanValue

public String compileToEffectiveBooleanValue(CompilerService compiler,
                                             Expression exp,
                                             ReturnAction options)
Description copied from class: ExpressionCompiler
Generate Java code to evaluate the effective boolean value of the expression

Specified by:
compileToEffectiveBooleanValue in class ExpressionCompiler
Parameters:
compiler - the compiler service
exp - the XPath expression to be compiled
options - indicates how the boolean result is to be returned
Returns:
the result depends on the supplied value of the options argument. If options is a JavaDeclaration, the code must declare a Java variable and return the name of this variable. If options is a JavaAssignment, the code must assign the value to an existing Java variable. If options is a Return, the code must generate a return statement that returns the value of the boolean (in which case the result of this method is null).

compileToCharSequence

public String compileToCharSequence(CompilerService compiler,
                                    Expression exp)
Compile Java code whose effect is to compute the string value of the expression; the generated code returns a CharSequence. This method must only be called for an expression that is known to return a value of type xs:string

Overrides:
compileToCharSequence in class ExpressionCompiler
Parameters:
exp - The expression to be compiled
compiler - the compiler service
Returns:
the name of a variable to which the resulting CharSequence is assigned, or a Java expression that can be used in a place where a variable reference of type CharSequence is allowed.


Copyright (c) 2004-2010 Saxonica Limited. All rights reserved.