If a ClassLoader does not implement this interface, then all the classes obtained from it should be considered as not reloadable (i.e. cacheable).
| Modifier and Type | Method and Description |
|---|---|
| public default ClassLoader | Returns: the original ClassLoader (the same reference by default)Return the original ClassLoader for this SmartClassLoader, or potentially the present loader itself if it is self-sufficient. |
| public default boolean | Returns: whether the class should be expected to appear in a reloaded version (with a differentClass object) later onthe class to check (usually loaded from this ClassLoader) clazz)Determine whether the given class is reloadable (in this ClassLoader). |
| public default Class | Returns: the newly created classthe name of the class name, byte[] the bytes defining the class b, ProtectionDomain the protection domain for the class, if any protectionDomain)Define a custom class (typically a CGLIB proxy class) in this class loader. |
| getOriginalClassLoader | back to summary |
|---|---|
| public default ClassLoader getOriginalClassLoader() Return the original ClassLoader for this SmartClassLoader, or potentially the present loader itself if it is self-sufficient. The default implementation returns the local ClassLoader reference as-is.
In case of a reloadable or other selectively overriding ClassLoader which
commonly deals with unaffected classes from a base application class loader,
this should get implemented to return the original ClassLoader that the
present loader got derived from (e.g. through This gets specifically used in Spring's AOP framework to determine the class loader for a specific proxy in case the target class has not been defined in the present class loader. In case of a reloadable class loader, we prefer the base application class loader for proxying general classes not defined in the reloadable class loader itself.
| |
| isClassReloadable | back to summary |
|---|---|
| public default boolean isClassReloadable(Class<?> clazz) Determine whether the given class is reloadable (in this ClassLoader). Typically used to check whether the result may be cached (for this
ClassLoader) or whether it should be reobtained every time.
The default implementation always returns
| |
| publicDefineClass | back to summary |
|---|---|
| public default Class Define a custom class (typically a CGLIB proxy class) in this class loader. This is a public equivalent of the protected
| |