public class JavaImportHelper
extends java.lang.Object
Constructor and Description |
---|
JavaImportHelper() |
Modifier and Type | Method and Description |
---|---|
protected static boolean |
isLoadedPackage(java.lang.String packageName)
Check if a java package is already known to the VM.
|
protected static boolean |
tryAddPackage(java.lang.String packageName,
PyObject fromlist)
Try to add the java package.
|
protected static boolean tryAddPackage(java.lang.String packageName, PyObject fromlist)
This is handy in cases where the package scan cannot run, or when the initial classpath does not contain all .jar files (such as in J2EE containers).
There is some self-healing in the sense that a correct, explicit import of a java class will succeed even if sys.modules already contains a Py.None entry for the corresponding java package.
packageName
- The dotted name of the java packagefromlist
- A tuple with the from names to import. Can be null or empty.true
if a java package was doubtlessly identified and added,
false
otherwise.protected static boolean isLoadedPackage(java.lang.String packageName)
May return false
even if the given package name is a valid java package !
packageName
- true
if the package with the given name is already loaded by the VM,
false
otherwise.