public static Class<?> getEntityClassFromNodeLabels(final List<String> labels, final List<Class<?>> classes)
throws NoSuchClassException {
for (final String label : labels) {
final Optional<Class<?>> classHit = classes.stream().filter(c -> {
// try to find the class based on its name
if (c.getName().endsWith(label)) {
return true;
} else {
// try to find the class based on the @Table(name) settings
final Table annotation = c.getAnnotation(Table.class);
return annotation != null && annotation.name().equals(label);
}
}).findFirst();
if (classHit.isPresent()) {
return classHit.get();
}
}
throw new NoSuchClassException("could not find class for a node with " + labels + " labels.");
}
EntityUtils.java 文件源码
java
阅读 40
收藏 0
点赞 0
评论 0
项目:jpa-unit
作者:
评论列表
文章目录