EntityClass.java 文件源码

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

项目:org.fastnate 作者:
/**
 * Fills the {@link #idProperty}.
 *
 * @param c
 *            the currently inspected class
 */
private void buildIdProperty(final Class<? super E> c) {
    // TODO (Issue #2) Support @IdClass

    // Find ID properties of super classes
    if (c.getSuperclass() != null) {
        buildIdProperty(c.getSuperclass());
    }

    // Find the Entity / MappedSuperclass annotation
    if (c.isAnnotationPresent(Entity.class) || c.isAnnotationPresent(MappedSuperclass.class)) {
        // Determine the access type
        if (this.accessStyle == null) {
            final Access accessType = c.getAnnotation(Access.class);
            if (accessType != null) {
                this.accessStyle = AccessStyle.getStyle(accessType.value());
            }
        }

        // And now find the id property of this class
        if (this.accessStyle == null) {
            if (findIdProperty(AccessStyle.FIELD.getDeclaredAttributes(c, this.entityClass))) {
                this.accessStyle = AccessStyle.FIELD;
            } else if (findIdProperty(AccessStyle.METHOD.getDeclaredAttributes(c, this.entityClass))) {
                this.accessStyle = AccessStyle.METHOD;
            }
        } else {
            findIdProperty(this.accessStyle.getDeclaredAttributes(c, this.entityClass));
        }
    }
}
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号