public static HairInfa createByReflect(Class clazz) {
HairInfa hair = null;
try {
Object obj = (Object) Class.forName(clazz.getName()).newInstance();
if (!(obj instanceof HairInfa)) {
//抛错
}
hair = (HairInfa) obj;
} catch (Exception e) {
//异常
}
return hair;
}
HairInfa hair = null;
try {
Object obj = (Object) Class.forName(clazz.getName()).newInstance();
if (!(obj instanceof HairInfa)) {
//抛错
}
hair = (HairInfa) obj;
} catch (Exception e) {
//异常
}
return hair;
}
2016-03-12