/**
* Given an entity, returns the table name for the entity.
* @param entity the entity to lookup.
* @return the name of the table for the entity.
*/
public static String getTableName(final Class<?> entity) {
final Entity annotation = entity.getAnnotation(Entity.class);
if(annotation == null) {
throw new IllegalArgumentException(entity.getName() + " does not have the Entity annotation");
}
final Table table = entity.getAnnotation(Table.class);
// get the table's name from the annotation
if(table != null && !table.name().isEmpty()) {
return table.name();
} else {
return entity.getSimpleName();
}
}
EntityUtils.java 文件源码
java
阅读 44
收藏 0
点赞 0
评论 0
项目:sop4j-dbutils
作者:
评论列表
文章目录