Top Description Fields Constructors Methods
org.python.core

public abstract Class JavaModule

extends PyModule
Class Inheritance
Known Direct Subclasses
org.python.core.BuiltinsModule

Common mechanisms for all Python modules defined in Java.

Field Summary

Modifier and TypeField and Description
pack-priv final ModuleDef
Inherited from org.python.core.PyModule:
dictnameTYPEtype

Constructor Summary

AccessConstructor and Description
protected
JavaModule(ModuleDef
of the module
definition
)

Construct the base JavaModule, saving the module definition, which is normally created during static initialisation of the concrete class defining the module.

Method Summary

Modifier and TypeMethod and Description
pack-priv void
exec()

Overrides org.python.core.PyModule.exec.

Initialise the module instance.
Inherited from org.python.core.PyModule:
addaddgetDictgetTypetoString

Field Detail

definitionback to summary
pack-priv final ModuleDef definition

Constructor Detail

JavaModuleback to summary
protected JavaModule(ModuleDef definition)

Construct the base JavaModule, saving the module definition, which is normally created during static initialisation of the concrete class defining the module. In terms of PEP 489 phases, the constructor performs the Py_mod_create. We defer filling the module dictionary from the definition and other sources until exec() is called.

Parameters
definition:ModuleDef

of the module

Method Detail

execback to summary
pack-priv void exec()

Overrides org.python.core.PyModule.exec.

Doc from org.python.core.PyModule.exec.

Initialise the module instance. The main action will be to add entries to dict. These become the members (globals) of the module.

In the case of a JavaModule, the base implementation mines the method definitions from the definition. The module should extend this method, that is call super.exec() to add boilerplate and the methods, then add other definitions (typically constants) to the module namespace with add(String, Object). In terms of PEP 489 phases, this is the Py_mod_exec phase.

Annotations
@Override