类中
public class InterfaceFactory {
OutBoundDbConnection outboundDbConnection = null;
public OutBoundDbConnection getOutboundDbConnection()
throws
InstantiationException,
IllegalAccessException,
ClassNotFoundException {
outboundDbConnection =
(OutBoundDbConnection) Class
.forName("com.isoftstone.struts.biz.dao.ConnData")
.newInstance();
return outboundDbConnection;
}
}
接口
public interface OutBoundDbConnection {
public Connection Dbconnection(String dbdrivers, String dbname);
public Connection Dbconnection();
public Connection Dbconnection1();
}
调用
InterfaceFactory interfaceFactory = new InterfaceFactory();
con = interfaceFactory.getOutboundDbConnection().Dbconnection();
本文地址:http://com.8s8s.com/it/it15680.htm