/**
* A partir du nom du fieldname, retorune le field
* @param cl
* @param fieldName
* @return
* @throws FieldNotFound
*/
private static Field getField(final Class cl, final String fieldName) throws FieldNotFound {
Class tClass = cl;
boolean found = false;
while (!found && (tClass.isAnnotationPresent(Entity.class) || tClass.isAnnotationPresent(MappedSuperclass.class))) {
try {
Field field = tClass.getDeclaredField(fieldName);
if (field.isAnnotationPresent(Lob.class)) {
throw new FieldNotFound();
}
return field;
} catch (NoSuchFieldException ex) { // on verifie dans la hierarchie aussi
tClass = tClass.getSuperclass();
}
}
throw new FieldNotFound();
}
EntityTools.java 文件源码
java
阅读 25
收藏 0
点赞 0
评论 0
项目:xcrud
作者:
评论列表
文章目录