Qore jni Module 2.3.1
Loading...
Searching...
No Matches
org.qore.jni.QoreURLClassLoader Class Reference

Main ClassLoader for Java <-> Qore and Java <-> Python integration. More...

Inherits URLClassLoader.

Public Member Methods

 QoreURLClassLoader (ClassLoader parent)
 constructor for using this class as the boot classloader More...
 
 QoreURLClassLoader ()
 constructor for using this class as the boot classloader for the module
 
 QoreURLClassLoader (long p_ptr)
 constructor for using this class as the boot classloader for the module
 
 QoreURLClassLoader (long p_ptr, ClassLoader parent)
 constructor with a QoreProgram pointer and a parent
 
 QoreURLClassLoader (String name, ClassLoader parent)
 constructor with a name and a parent
 
void add (final String qualifiedClassName, final QoreJavaFileObject javaFile)
 
Collection< QoreJavaFileObjectfiles ()
 
void addPendingClass (String bin_name, byte[] byte_code)
 adds byte code for an inner class to the byte code cache; requires a binary name (ex: my.package.MyClass$1)
 
Class<?> checkLoadedClass (String bin_name)
 
Class<?> loadClass (String bin_name) throws ClassNotFoundException
 
Class<?> loadClassWithPtr (String bin_name, long class_ptr) throws ClassNotFoundException
 Returns the Java class from the given Qore class with a Qore class ptr.
 
void addPath (String classpath)
 Adds a path to the classpath.
 
ArrayList< String > getClassesInNamespace (String packageName)
 Returns a list of classes in the given dynamic package.
 
void addWildcard (File dir, String nam)
 
void clearCompilationCache ()
 

Static Public Member Methods

static boolean isDynamic (String bin_name)
 Returns true if the given package name is dynamic.
 

Private Member Methods

Class<?> findClass (String bin_name) throws ClassNotFoundException
 Supports generating classes from byte code as well as returning classes built in to the jni module.
 

Detailed Description

Main ClassLoader for Java <-> Qore and Java <-> Python integration.

This ClassLoader supports dynamic imports from Qore and Java using the following special packages:

  • python.[path...]: indicates that the given path should be imported from Python to Java (after being imported to Qore if necessary).
  • pythonmod.mod.[path...]: indicates that the given path should be mapped to Qore namespaces and/or classes after loading the Python module mod and importing into Qore; the Java package segments after pythonmod.mod. are then converted to the equivalent Qore namespace path
  • qore: indicates that the given path should be mapped to Qore namespaces and/or classes; the Java package segments after qore. are then converted to the equivalent Qore namespace path
  • qoremod.mod.[path...]: indicates that the given path should be mapped to Qore namespaces and/or classes after loading the Qore module mod; the Java package segments after qoremod.mod. are then converted to the equivalent Qore namespace path

Constructor & Destructor Documentation

◆ QoreURLClassLoader()

org.qore.jni.QoreURLClassLoader.QoreURLClassLoader ( ClassLoader  parent)
inline

constructor for using this class as the boot classloader

For example, starting Java like: java -cp xxx -Djava.system.class.loader=org.qore.jni.QoreURLClassLoader ... will result in this constructor being called

Member Function Documentation

◆ add()

void org.qore.jni.QoreURLClassLoader.add ( final String  qualifiedClassName,
final QoreJavaFileObject  javaFile 
)
inline

Add a class name/JavaFileObject mapping

Parameters
qualifiedClassNamethe name
javaFilethe file associated with the name

◆ addWildcard()

void org.qore.jni.QoreURLClassLoader.addWildcard ( File  dir,
String  nam 
)
inline

Adds a set of files using a generic base name to this loader's classpath. See addClassPath(String) for details of the generic base name.

◆ checkLoadedClass()

Class<?> org.qore.jni.QoreURLClassLoader.checkLoadedClass ( String  bin_name)
inline

Check if the class is loaded in this class loader or in the parent if it's a QoreURLClassLoader

Parameters
bin_namethe class to check
Returns
the class if it's loaded

◆ clearCompilationCache()

void org.qore.jni.QoreURLClassLoader.clearCompilationCache ( )
inline

Clears the compilation cache after compiling

◆ files()

Collection< QoreJavaFileObject > org.qore.jni.QoreURLClassLoader.files ( )
inline
Returns
An collection of QoreJavaFileObject instances for the classes in the class loader.

◆ loadClass()

Class<?> org.qore.jni.QoreURLClassLoader.loadClass ( String  bin_name) throws ClassNotFoundException
inline

Loads classes; returns pending classes injected by the jni module or the compiler


The documentation for this class was generated from the following file: