|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object org.mozilla.javascript.ClassCache
public class ClassCache
Cache of generated classes and data structures to access Java runtime from JavaScript.
Constructor Summary | |
---|---|
ClassCache()
|
Method Summary | |
---|---|
boolean |
associate(ScriptableObject topScope)
Associate ClassCache object with the given top-level scope. |
void |
clearCaches()
Empty caches of generated Java classes and Java reflection information. |
static ClassCache |
get(Scriptable scope)
Search for ClassCache object in the given scope. |
boolean |
isCachingEnabled()
Check if generated Java classes and Java reflection information is cached. |
boolean |
isInvokerOptimizationEnabled()
Deprecated. The method always returns false. |
int |
newClassSerialNumber()
Internal engine method to return serial number for generated classes to ensure name uniqueness. |
void |
setCachingEnabled(boolean enabled)
Set whether to cache some values. |
void |
setInvokerOptimizationEnabled(boolean enabled)
Deprecated. The method does nothing. Invoker optimization is no longer used by Rhino. On modern JDK like 1.4 or 1.5 the disadvantages of the optimization like increased memory usage or longer initialization time overweight small speed increase that can be gained using generated proxy class to replace reflection. |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Constructor Detail |
---|
public ClassCache()
Method Detail |
---|
public static ClassCache get(Scriptable scope)
ScriptableObject.getTopLevelScope(Scriptable scope)
to get the top most scope and then tries to locate associated
ClassCache object in the prototype chain of the top scope.
scope
- scope to search for ClassCache object.
associate(ScriptableObject topScope)
public boolean associate(ScriptableObject topScope)
topScope
- scope to associate this ClassCache object with.
get(Scriptable scope)
public void clearCaches()
public final boolean isCachingEnabled()
public void setCachingEnabled(boolean enabled)
By default, the engine will cache the results of Class.getMethods() and similar calls. This can speed execution dramatically, but increases the memory footprint. Also, with caching enabled, references may be held to objects past the lifetime of any real usage.
If caching is enabled and this method is called with a
false
argument, the caches will be emptied.
Caching is enabled by default.
enabled
- if true, caching is enabledclearCaches()
public boolean isInvokerOptimizationEnabled()
setInvokerOptimizationEnabled(boolean enabled)
public void setInvokerOptimizationEnabled(boolean enabled)
public final int newClassSerialNumber()
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |