Package org.kyle.net.svr.sample;
Public Class IntegrationFactory
{
Public integrationFactory ()
{
}
Public Static IListener Createlistener (Genprofile Gencfg)
{
Ilistener ilistener = null;
Try {
/ / Create a corresponding instance according to the class name set in the configuration file
IListener = (ilistener) instantiateit (Gencfg.getListenerImpl ());
}
Catch (Exception E) {
Debug.info ("Listener Class Not Found!");
// If the specified class does not exist, create an instance using the default class, and because the interface is referenced in the program, it provides a reference to the default class. It is required to compile mainclass when compiling. No need to compile separately. Default class
IListener = new SampleListenerImpl ();
}
Return IListener;
}
/ / Get the instance of the class according to the name of the class
Public Static Object Instantiateit (String Clsname)
Throws ClassNotFoundException,
ClassCastException,
InstantiationException,
ILLEGALACCESSEXCEPTION
{
Class CLS = Class.Forname (clsname);
Return CLS.NEWINSTANCE ();
}
}
Add: listener = org.kyle.net.svr.sample.sampleListenerImpl