The information about a module.
The module instance is always created by the system and can be retrieved either from a Type, or calling find() method.
A module instance holds only the meta-info about the types in this module. Of particular note, it doesn't contain Type instances for each type contained within. Therefore obtaining a module instance from find() will not trigger the loading of any Types. A relatively light-weighted, and free of side-effect, scanning over all the module files will still be performed to extract the bare minimum meta-info about each type.
To get the instance of a module's Type, one may call load() on the meta-info object.
Parent Class
Type | Name | Signature |
---|---|---|
method S | find | public static Module find(string, bool) |
method | getName | public String getName() |
method | getScripts | public Script[] getScripts() |
method | getTypes | public TypeInfo[] getTypes() |
method | toString | public String toString() |
public static Module find(string name, bool throwOnError)
Find the module with the specified name.
Required Policies
System.Reflection/load
Parameters
Returns
throwOnError
is false and the module couldn't be successfully scanned (typically due to syntactic/semantic errors found on the definitions), this method also returns null.public String getName()
Get the module's name.
Returns
public Script[] getScripts()
Get the module's constituent scripts.
A module can contain one or more scripts, but a script can only belong to one module. The Script object returned by this method has a method to retrieve its Module, which should be referentially equivalent to the current Module object.
Returns
public TypeInfo[] getTypes()
Get the module's types in the form of TypeInfo.
The fact that a type appears in the resultant array doesn't guarantee a successful loading. The type info is collected based on a minimal scanning of the type definition and will skip over many critical parts which may contain syntax or semantic errors. Those errors won't be detected until the type is to be fully loaded.
If the module is from the system (with name being "System" or starting with "System."), only public types will be returned. If the module is defined by users, all types will be returned. However, not all of those types maybe ultimately usable via reflection. Should it be loaded, its constructors may very well be opted out of reflection-based invocation.
Returns
public String toString()
Get a string representation of this module.
Returns
[MODULE|full-name]
. Example: [MODULE|MyNamespace.MyModule]