nu.staldal.lsp.compiler
Class LSPCompiler

java.lang.Object
  extended by nu.staldal.lsp.compiler.LSPCompiler

public class LSPCompiler
extends java.lang.Object

Compiles an LSP page into JVM bytecode.

An instance of this class may be reused, but is not thread safe.

See Also:
LSPCompilerHelper

Constructor Summary
LSPCompiler()
          Create a new LSP compiler.
 
Method Summary
 void finishCompile(java.io.OutputStream out)
          Finish the compilation.
 void setAcceptNull(boolean acceptNull)
          Deprecated. use setAcceptUnbound(boolean) instead
 void setAcceptUnbound(boolean acceptUnbound)
          Set to true to make the compiled page accept unbound values without runtime error.
 void setEnclose(java.lang.String encloseURL)
          Set enclose to use.
 void setHtml(boolean html)
          Set to true to use html as default output type.
 void setXhtml(boolean xhtml)
          Deprecated. XHTML is now default, use setHtml(boolean) to override it.
 org.xml.sax.ContentHandler startCompile(java.lang.String page, URLResolver r)
          Start compilation of an LSP page.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

LSPCompiler

public LSPCompiler()
Create a new LSP compiler. The instance may be reused, but may not be used from several threads concurrently. Create several instances if multiple threads needs to compile concurrently.

Method Detail

setXhtml

@Deprecated
public void setXhtml(boolean xhtml)
Deprecated. XHTML is now default, use setHtml(boolean) to override it.

Set to true to use xhtml as default output type.

Parameters:
xhtml -

setHtml

public void setHtml(boolean html)
Set to true to use html as default output type.

Parameters:
html -

setAcceptNull

@Deprecated
public void setAcceptNull(boolean acceptNull)
Deprecated. use setAcceptUnbound(boolean) instead

Parameters:
acceptNull -

setAcceptUnbound

public void setAcceptUnbound(boolean acceptUnbound)
Set to true to make the compiled page accept unbound values without runtime error.

Parameters:
acceptUnbound -

setEnclose

public void setEnclose(java.lang.String encloseURL)
Set enclose to use. Set to null to not use any enclose.

Parameters:
encloseURL - URL to the enclose to use

startCompile

public org.xml.sax.ContentHandler startCompile(java.lang.String page,
                                               URLResolver r)
                                        throws LSPException
Start compilation of an LSP page.

Parameters:
page - page name
r - URLResolver to use for resolving <lsp:import> and enclose
Returns:
SAX2 ContentHandler to feed the LSP source into
Throws:
LSPException

finishCompile

public void finishCompile(java.io.OutputStream out)
                   throws org.xml.sax.SAXException,
                          java.io.IOException
Finish the compilation.

Parameters:
out - where to write the compiled code (as JVM bytecode).
Throws:
org.xml.sax.SAXException - if any compilation error occurs
java.io.IOException - if any I/O error occurs when reading <lsp:import>ed files, or when writing compiled code