com.myarch.reloader
Class ReloadMainController
java.lang.Object
|
+--com.myarch.reloader.ReloadMainController
- All Implemented Interfaces:
- LoadController
- public class ReloadMainController
- extends java.lang.Object
- implements LoadController
Makes Reloader
to re-load only the main class.
Main class is the one that was explicitly passed to reload()
as a parameter.
All other classes won't be re-loaded.
This controller is default for Reloader
It is the most simple way to manipulate dynamic reloading. Simply use Reloader
for ALL classes that are supposed to be reloadable, do not call classes directly.
You will have to create an interface for each class.
- Author:
- Alexander Ananiev
Method Summary |
boolean |
isLoadByParentAllowed(java.lang.String className,
java.lang.String mainClassName,
java.lang.ClassLoader loader)
Prohibits using parent loader for loadable classes.
|
boolean |
isReloadAllowed(java.lang.String className,
java.lang.String mainClassName,
java.lang.ClassLoader loader)
Returns true if a class to reload is the main class. |
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
ReloadMainController
public ReloadMainController()
isReloadAllowed
public boolean isReloadAllowed(java.lang.String className,
java.lang.String mainClassName,
java.lang.ClassLoader loader)
- Returns
true
if a class to reload is the main class.
- Specified by:
isReloadAllowed
in interface LoadController
- Parameters:
className
- class name to loadmainClassName
- name of the "main" class.
Main class is a class passed as a parameter to Reloader.reload()
method.loader
- the actual class loader used to load a class- Returns:
true
if mainClassName.equals(className)
isLoadByParentAllowed
public boolean isLoadByParentAllowed(java.lang.String className,
java.lang.String mainClassName,
java.lang.ClassLoader loader)
- Prohibits using parent loader for loadable classes.
This ensures that the class (main class in this case) is either loaded
by the
Reloader
or ClassNotFoundException
is thrown.
- Specified by:
isLoadByParentAllowed
in interface LoadController
- Parameters:
className
- class name to loadmainClassName
- name of the "main" class.
Main class is a class passed as a parameter to Reloader.reload()
method.loader
- the actual class loader used to load a class (parent loader).- Returns:
false
all the time to prohibit using the parent loader.
Copyright © 2001 Alexander Ananiev & MyArch.com. All Rights Reserved.