Package com.storedobject.core
Class JavaClassLoader
java.lang.Object
java.lang.ClassLoader
com.storedobject.core.JavaClassLoader
Class loaded used internally by the platform to load classes from the database.
- Author:
- Syam
-
Method Summary
Modifier and TypeMethodDescriptionstatic void
Clears the cache for classes that were not found.static Class
<?> createClassFromProperty
(String propertyName) Creates a Java Class based on the logic name specified by the given property name.static Object
createInstance
(String logicName) Creates an instance of a logic class specified by its name.static Object
createInstanceFromProperty
(String propertyName) Creates an instance of a class associated with the specified property name.static boolean
Check whether a logic or data class exists or not.Class
<?> Find a class.static Class
<?> Load a logic or data class from the database.static Class
<?> Load a logic or data class from the database.static boolean
Check whether a logic or data class is already loaded or not.Methods inherited from class java.lang.ClassLoader
clearAssertionStatus, defineClass, defineClass, defineClass, defineClass, definePackage, findClass, findLibrary, findLoadedClass, findResource, findResource, findResources, findSystemClass, getClassLoadingLock, getDefinedPackage, getDefinedPackages, getName, getPackage, getPackages, getParent, getPlatformClassLoader, getResource, getResourceAsStream, getResources, getSystemClassLoader, getSystemResource, getSystemResourceAsStream, getSystemResources, getUnnamedModule, isRegisteredAsParallelCapable, loadClass, loadClass, registerAsParallelCapable, resolveClass, resources, setClassAssertionStatus, setDefaultAssertionStatus, setPackageAssertionStatus, setSigners
-
Method Details
-
findClass
Find a class.- Overrides:
findClass
in classClassLoader
- Parameters:
name
- Name of the class.- Returns:
- Class.
- Throws:
ClassNotFoundException
- If class is not found.
-
clearNoFoundCache
public static void clearNoFoundCache()Clears the cache for classes that were not found.Note: This method is used in development mode only.
-
getLogic
Load a logic or data class from the database.- Parameters:
name
- Name of the class to load.- Returns:
- Class loaded.
- Throws:
ClassNotFoundException
- If class is not found.
-
getLogic
Load a logic or data class from the database.- Parameters:
name
- Name of the class to load.resolve
- Whether to resolve the class or not.- Returns:
- Class loaded.
- Throws:
ClassNotFoundException
- If class is not found.
-
exists
Check whether a logic or data class exists or not.- Parameters:
name
- Name of the class.- Returns:
- True/false.
-
loaded
Check whether a logic or data class is already loaded or not.- Parameters:
name
- Name of the class.- Returns:
- True/false.
-
createClassFromProperty
Creates a Java Class based on the logic name specified by the given property name.- Parameters:
propertyName
- The name of the property to fetch the associated logic name.- Returns:
- The Java Class object associated with the logic name of the property or null if the logic name is blank.
- Throws:
SOException
- If the logic class associated with the property cannot be created.
-
createInstanceFromProperty
Creates an instance of a class associated with the specified property name. The class is determined based on a property and instantiated using its no-argument constructor.- Parameters:
propertyName
- The name of the property used to resolve the class to be instantiated.- Returns:
- An instance of the resolved class, or null if the class could not be determined.
- Throws:
SOException
- If there is an error in creating the instance or resolving the class.
-
createInstance
Creates an instance of a logic class specified by its name.- Parameters:
logicName
- Name of the logic class to create an instance of.- Returns:
- A new instance of the specified logic class.
- Throws:
SOException
- If the class cannot be found or the instance cannot be created.
-