|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectpnuts.lang.Runtime
pnuts.lang.PnutsImpl
pnuts.ext.CachedPnutsImpl
public class CachedPnutsImpl
PnutsImpl which caches parsed (compiled) scripts and reuse them. This class is useful when same scripts are executed over and over, e.g. servlet scripts.
PnutsImpl
Nested Class Summary | |
---|---|
static class |
CachedPnutsImpl.ScriptCacheEntry
|
Nested classes/interfaces inherited from class pnuts.lang.Runtime |
---|
Runtime.Accessor, Runtime.Break, Runtime.Continue, Runtime.FunctionSerializer, Runtime.TypeMap |
Field Summary |
---|
Fields inherited from class pnuts.lang.PnutsImpl |
---|
properties |
Fields inherited from class pnuts.lang.Runtime |
---|
BOOLEAN_SYMBOL, BYTE_SYMBOL, CHAR_SYMBOL, CLONE, DOUBLE_SYMBOL, EXCEPTOIN_FIELD_SYMBOL, FLOAT_SYMBOL, INT_SYMBOL, LONG_SYMBOL, SHORT_SYMBOL, VOID_SYMBOL |
Constructor Summary | |
---|---|
CachedPnutsImpl()
|
|
CachedPnutsImpl(boolean useCompiler)
|
|
CachedPnutsImpl(boolean useCompiler,
boolean useDynamicProxy,
boolean includeLineNo)
|
|
CachedPnutsImpl(boolean useCompiler,
boolean useDynamicProxy,
boolean includeLineNo,
org.pnuts.util.Cache cache)
|
Method Summary | |
---|---|
protected static org.pnuts.util.Cache |
createCache()
|
java.lang.Object |
eval(java.lang.String script,
Context context)
Evaluate an expreesion |
protected CachedPnutsImpl.ScriptCacheEntry |
getCachedCode(java.lang.Object key)
|
void |
includeLineNo(boolean flag)
|
java.lang.Object |
load(java.net.URL scriptURL,
Context context)
Load a script file from a URL |
protected void |
putCachedCode(java.lang.Object key,
CachedPnutsImpl.ScriptCacheEntry entry)
|
void |
reset()
Reset the cache entries |
Methods inherited from class pnuts.lang.PnutsImpl |
---|
accept, getDefault, load, loadFile, popFile, provide, pushFile, queryProperty, revoke, setProperties, setProperty |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Constructor Detail |
---|
public CachedPnutsImpl()
public CachedPnutsImpl(boolean useCompiler)
useCompiler
- true if compiler is used (default)public CachedPnutsImpl(boolean useCompiler, boolean useDynamicProxy, boolean includeLineNo)
useCompiler
- true if the compiler is used (default)useDynamicProxy
- true if the compiler generates dynamic proxy.includeLineNo
- true if the compiler generates line number information.public CachedPnutsImpl(boolean useCompiler, boolean useDynamicProxy, boolean includeLineNo, org.pnuts.util.Cache cache)
useCompiler
- true if the compiler is used (default)useDynamicProxy
- true if the compiler generates dynamic proxy.includeLineNo
- true if the compiler generates line number information.cache
- a cache object to reuse compiled codeMethod Detail |
---|
public void includeLineNo(boolean flag)
protected static org.pnuts.util.Cache createCache()
public void reset()
protected CachedPnutsImpl.ScriptCacheEntry getCachedCode(java.lang.Object key)
protected void putCachedCode(java.lang.Object key, CachedPnutsImpl.ScriptCacheEntry entry)
public java.lang.Object load(java.net.URL scriptURL, Context context)
load
in interface Implementation
load
in class PnutsImpl
scriptURL
- the URL of the scriptcontext
- the context in which the script is executed
public java.lang.Object eval(java.lang.String script, Context context)
PnutsImpl
eval
in interface Implementation
eval
in class PnutsImpl
script
- the expression to be evaluatedcontext
- the context in which the expression is evaluated
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |