|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectoscript.data.Value
oscript.data.OObject
oscript.data.ScriptPackage
The implementation of a package system for scripts. This handles
automatically import
ing script source files when the
have not yet been loaded, or are out of date. The script package
system relies on a couple of coding conventions:
FooBar
,
is declared in the source file foo/bar/FooBar.os.
Other variables or functions that are private (ie. not
public
) to that source file may be declared
in the source file.
const var foo = new ScriptPackage("/path/to/foo"); var fb = new foo.bar.FooBar();When resolving the request for the member
FooBar
,
if the source file /path/to/foo/bar/FooBar.os has not yet
been loaded, or has been modified since the last time it was
accessed, the package system will create a new scope and import
the source file into that scope. It will then return the public
variable/function FooBar
.
Field Summary | |
static java.lang.String[] |
MEMBER_NAMES
|
static java.lang.String |
PARENT_TYPE_NAME
|
static Value |
TYPE
The type object for an instance of ScriptPackage. |
static java.lang.String |
TYPE_NAME
|
Fields inherited from class oscript.data.OObject |
EMPTY_EXPR_LIST_EVALUATOR |
Fields inherited from class oscript.data.Value |
DEBUG, NULL, UNDEFINED |
Constructor Summary | |
ScriptPackage(MemberTable args)
Class Constructor. |
|
ScriptPackage(java.lang.String path)
Class Constructor. |
|
ScriptPackage(java.lang.String path,
Scope parentScope)
Class Constructor. |
Method Summary | |
java.lang.String |
castToString()
Convert this object to a native java String value. |
Value |
getMember(int id,
boolean exception)
Get a member of this object. |
protected Value |
getTypeImpl()
Get the type of this object. |
protected void |
populateMemberSet(java.util.Set s,
boolean debugger)
Derived classes that implement getMember(int, boolean) should also
implement this. |
void |
reset()
Clear the cached members. |
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
Field Detail |
public static final Value TYPE
public static final java.lang.String PARENT_TYPE_NAME
public static final java.lang.String TYPE_NAME
public static final java.lang.String[] MEMBER_NAMES
Constructor Detail |
public ScriptPackage(java.lang.String path, Scope parentScope)
parentScope
- the parent scope of this packagepublic ScriptPackage(java.lang.String path)
public ScriptPackage(MemberTable args) throws PackagedScriptObjectException
args
- arguments to this constructor
PackagedScriptObjectException(Exception)
- if wrong number of args
PackagedScriptObjectException
Method Detail |
protected Value getTypeImpl()
Value.getType()
.
getTypeImpl
in class OObject
public void reset()
public java.lang.String castToString() throws PackagedScriptObjectException
String
value.
castToString
in class OObject
PackagedScriptObjectException(NoSuchMethodException)
PackagedScriptObjectException
public Value getMember(int id, boolean exception) throws PackagedScriptObjectException
getMember
in class OObject
id
- the id of the symbol that maps to the memberexception
- whether an exception should be thrown if the
member object is not resolved
PackagedScriptObjectException(NoSuchMethodException)
PackagedScriptObjectException(NoSuchMemberException)
PackagedScriptObjectException
protected void populateMemberSet(java.util.Set s, boolean debugger)
getMember(int, boolean)
should also
implement this.
populateMemberSet
in class OObject
s
- the set to populatedebugger
- true
if being used by debugger, in
which case both public and private/protected field names should
be returnedgetMember(int, boolean)
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |