|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectpnuts.lang.Pnuts
pnuts.ext.CachedScript
public class CachedScript
Executable script that is automatically recompiled
Field Summary | |
---|---|
protected java.lang.String |
encoding
|
protected long |
parsedTime
|
protected Pnuts |
script
|
protected java.net.URL |
scriptURL
|
Fields inherited from class pnuts.lang.Pnuts |
---|
pnuts_version, prompt, scriptSource, startNodes |
Constructor Summary | |
---|---|
CachedScript(java.net.URL scriptURL)
Constructor |
|
CachedScript(java.net.URL scriptURL,
java.lang.String encoding,
Context context)
Constructor |
Method Summary | |
---|---|
java.lang.Object |
accept(Visitor v,
Context c)
traverse the parsed tree with the specified Visitor and Context |
protected Compiler |
getCompiler()
Returns a compiler. |
protected boolean |
needToUpdate()
Determin if the script should be recompiled |
java.lang.Object |
run(Context c)
Executes a Pnuts object with the specified Context |
java.lang.String |
unparse()
Obtain the script code from a parsed object |
protected void |
update(Context context)
Parse/compile the script and update the timestamp. |
Methods inherited from class pnuts.lang.Pnuts |
---|
accept, createClassLoader, createClassLoader, eval, evalDepth, format, get, get, getDefaults, getResource, getScriptSource, isJava2, isVerbose, load, load, load, load, load, load, loadClass, loadFile, parse, parse, parse, parse, parse, parse, require, require, set, set, setDefaults, setPrompt, setScriptSource, setVerbose, unparse |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
---|
protected java.net.URL scriptURL
protected long parsedTime
protected Pnuts script
protected java.lang.String encoding
Constructor Detail |
---|
public CachedScript(java.net.URL scriptURL) throws java.io.IOException, ParseException
scriptURL
- the URL of the script
java.io.IOException
ParseException
public CachedScript(java.net.URL scriptURL, java.lang.String encoding, Context context) throws java.io.IOException, ParseException
scriptURL
- the URL of the scriptencoding
- the character encoding of the script. If null, the default encoding is used.context
- the context in which the script is first parsed/compiled.
java.io.IOException
ParseException
Method Detail |
---|
public java.lang.String unparse()
Pnuts
unparse
in class Pnuts
public java.lang.Object run(Context c)
Pnuts
run
in interface Executable
run
in class Pnuts
c
- the Context
public java.lang.Object accept(Visitor v, Context c)
Pnuts
accept
in class Pnuts
c
- the Context
protected boolean needToUpdate()
protected Compiler getCompiler()
protected void update(Context context) throws java.io.IOException, ParseException
context
- the context in which the script is compiled.
java.io.IOException
ParseException
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |