Class RubyJessopScriptBuilder
- All Implemented Interfaces:
JessopScriptBuilder
-
Field Summary
Fields inherited from class com.randomnoun.common.jessop.AbstractJessopScriptBuilder
declarations, pw, tokeniser
-
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptionvoid
emitExpression
(int line, String s) Called by the tokeniser and requests that this JessopScriptBuilder generate code to generate some evaluated output.void
emitScriptlet
(int line, String s) Called by the tokeniser and requests that this JessopScriptBuilder copy the included code into the generated script.void
Called by the tokeniser and requests that this JessopScriptBuilder generate code to generate some text output.Returns the name of the default exceptionConverter class that should be used for the default script engine, or null if no converter is required.Returns the name of the script engine that is used to evaluate this script; e.g.Returns the name of the language that this scriptBuilder can parse; e.g.Methods inherited from class com.randomnoun.common.jessop.AbstractJessopScriptBuilder
emitDeclaration, getDeclarations, getDefaultBindingsConverterClassName, setPrintWriter, setTokeniserAndDeclarations, suppressEol
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
Methods inherited from interface com.randomnoun.common.jessop.JessopScriptBuilder
emitDeclaration, getDeclarations, getDefaultBindingsConverterClassName, setPrintWriter, setTokeniserAndDeclarations
-
Constructor Details
-
RubyJessopScriptBuilder
public RubyJessopScriptBuilder()
-
-
Method Details
-
emitText
Description copied from interface:JessopScriptBuilder
Called by the tokeniser and requests that this JessopScriptBuilder generate code to generate some text output.This method should escape the output and generate code that outputs this text in the implementation language.
- Specified by:
emitText
in interfaceJessopScriptBuilder
- Specified by:
emitText
in classAbstractJessopScriptBuilder
- Parameters:
line
- jessop source line number that begins this text outputs
- the text to output; may include newlines.
-
emitExpression
Description copied from interface:JessopScriptBuilder
Called by the tokeniser and requests that this JessopScriptBuilder generate code to generate some evaluated output. i.e. process a<%= ... %>
expression.This method should generate the code to evaluate and output the contents of the
<%= ... %>
expression.This method should attempt to preserve line numbers between the jessop source file and the generated code file.
- Specified by:
emitExpression
in interfaceJessopScriptBuilder
- Specified by:
emitExpression
in classAbstractJessopScriptBuilder
- Parameters:
line
- jessop source line number that begins this text output.s
- the contents of the<%= ... %>
expression.
-
emitScriptlet
Description copied from interface:JessopScriptBuilder
Called by the tokeniser and requests that this JessopScriptBuilder copy the included code into the generated script. i.e. process a<% ... %>
scriptlet. (The 'scriptlet' term is the term used in the JSP specification)This method should generate the same code that is contained within the
<% ... %>
scriptlet.This method should attempt to preserve line numbers between the jessop source file and the generated code file.
This scriptlet may not be syntactically correct by itself and may require further scriptlets to function, e.g.
<% if (a > b) { %> something <% } %>
- Specified by:
emitScriptlet
in interfaceJessopScriptBuilder
- Specified by:
emitScriptlet
in classAbstractJessopScriptBuilder
- Parameters:
line
- jessop source line number that begins this scriptlet.s
- the contents of the<%= ... %>
expression.
-
getLanguage
Description copied from interface:JessopScriptBuilder
Returns the name of the language that this scriptBuilder can parse; e.g. "javascript" or "python2".This is used to register this JessopScriptBuilder in the registry and is used to lookup the JessopScriptBuilder from the language defined in the jessop script declaration.
- Specified by:
getLanguage
in interfaceJessopScriptBuilder
- Returns:
- the name of the language that this scriptBuilder can parse; e.g. "javascript" or "python2".
-
getDefaultScriptEngineName
Description copied from interface:JessopScriptBuilder
Returns the name of the script engine that is used to evaluate this script; e.g. "rhino" or "jython"- Specified by:
getDefaultScriptEngineName
in interfaceJessopScriptBuilder
- Returns:
- the name of the script engine that is used to evaluate this script; e.g. "rhino" or "jython"
-
getDefaultExceptionConverterClassName
Description copied from interface:JessopScriptBuilder
Returns the name of the default exceptionConverter class that should be used for the default script engine, or null if no converter is required.Changing the engine in the jessop declaration will reset the the converter to null.
- Specified by:
getDefaultExceptionConverterClassName
in interfaceJessopScriptBuilder
- Overrides:
getDefaultExceptionConverterClassName
in classAbstractJessopScriptBuilder
- Returns:
- the name of the default exceptionConverter class that should be used for the default script engine
-