EntityUtils.java 文件源码

java
阅读 40 收藏 0 点赞 0 评论 0

项目:jpa-unit 作者:
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.");
}
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号