应用反射时的一个小问题
今天刚刚接触了一小点反射。有个小问题。请教大家。
daoClass = Class.forName(daoClassName);//这里是用反射获取一个类名,和它的一个方法Class methodParameterTypes[] = new Class[1];methodParameterTypes[0] = Integer.TYPE;Method targetMethodInfo = daoClass.getMethod("findById", methodParameterTypes);
public TblPotential findById(java.lang.Integer id) { log.debug("getting TblPotential instance with id: " + id); try { TblPotential instance = (TblPotential) getSession().get( "com.minicrm.hibernate.tables.TblPotential", id); return instance; } catch (RuntimeException re) { log.error("get failed", re); throw re; } }
public TblPotential findById(int id){ return findById(id); }