分页封装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;
}
}

你可能感兴趣的:(java,C++,c,bean,swing)