yqklw521 发表于 2013-2-5 02:35:54

分页封装1

import java.util.List;

public interface PageInterface {
public List getTableList(int page, int rows);
}

public class PageFactory {
public static PageInterface getClass(String className)
throws InstantiationException, IllegalAccessException {
PageInterface production = null;
try {
production = (PageInterface) Class.forName(className).newInstance();
} catch (ClassNotFoundException ex) {
ex.printStackTrace();
}
return production;
}
}

import java.util.List;

public class PageList {
public List showListOfTable(String a, int page, int rows)
throws InstantiationException, IllegalAccessException {
PageInterface cat = PageFactory.getClass(a);
List list = cat.getTableList(page, rows);
return list;
}
}
页: [1]
查看完整版本: 分页封装1