|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectpnuts.ext.ModuleBase
public abstract class ModuleBase
Base class of modules. This class provides convenient autloading functions and an error reporting function. Modules may (or may not) subclass this class.
Constructor Summary | |
---|---|
ModuleBase()
|
Method Summary | |
---|---|
protected void |
autoload(java.lang.String[] functionNames,
java.lang.String file,
Context context)
Registers an autoloaded script for functionNames. |
protected void |
autoloadClass(java.lang.String javaPackage,
java.lang.String name,
Context context)
Registers an autoloaded Class object. |
protected void |
autoloadFunction(java.lang.String functionName,
Context context)
Registers an autoloaded class for functionName. |
protected java.lang.Object |
execute(Context context)
Subclasses should override this method, instead of run(Context), to define the initialization process. |
protected java.lang.String |
getClassName(Package pkg,
java.lang.String name)
Makes a class name for the specified package and the symbol's name. |
protected Package |
getPackage(Context context)
|
protected java.lang.String |
getPrefix()
Defines the prefix of script class (resource) name. |
protected java.lang.String[] |
getRequiredModules()
This method is supposed to be redefined in a subclass to define a set of modules that are required to implement this module. |
protected java.lang.String[] |
getSubModules()
This method is supposed to be redefined in a subclass to define a set of modules that this module provides in the caller's context. |
protected java.lang.Object |
newInstance(java.lang.Class cls)
This method is redefined in subclasses so that package private classes can be used. |
java.lang.Object |
run(Context context)
Defines ERROR and EXPORTS, and then call execute(Context). |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Constructor Detail |
---|
public ModuleBase()
Method Detail |
---|
protected void autoload(java.lang.String[] functionNames, java.lang.String file, Context context)
functionNames
- the function namesfile
- a script file to be loaded when one of the functionNames is
first resolved.context
- the contextprotected void autoloadFunction(java.lang.String functionName, Context context)
functionName
- the function namecontext
- the contextprotected void autoloadClass(java.lang.String javaPackage, java.lang.String name, Context context)
javaPackage
- Java package name, e.g. "java.util"name
- short Class name, e.g. "HashMap"context
- the contextprotected java.lang.String getPrefix()
protected Package getPackage(Context context)
protected java.lang.Object newInstance(java.lang.Class cls) throws java.lang.IllegalAccessException, java.lang.InstantiationException
cls
- the class to be instantiated
java.lang.IllegalAccessException
java.lang.InstantiationException
protected java.lang.String getClassName(Package pkg, java.lang.String name)
pkg
- the packagename
- the symbol
public java.lang.Object run(Context context)
run
in interface Executable
context
- the context
protected java.lang.Object execute(Context context)
context
- the contextprotected java.lang.String[] getRequiredModules()
protected java.lang.String[] getSubModules()
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |