JpaEntityResourceMetadataExtractor.java 文件源码

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

项目:bjug-querydsl 作者:
/**
 * Get the property metadata
 * for the supplied property
 * @param property
 * @param builder
 */
@SuppressWarnings("unchecked")
private void extractPropertyMetadata(PropertyDescriptor property, ResourceMetadataBuilder builder) {
    // Get the field for the property
    Method accessor = property.getReadMethod();

    // Get the property name
    String name = property.getName();

    // Is it an identity field?
    if (AnnotationHelper.fieldOrPropertyAnnotated(property, Id.class)) {
        builder.identityProperty(name, accessor);
    }

    // Is it a relation field (and therefore embedded)?
    else if (AnnotationHelper.fieldOrPropertyAnnotated(property, ManyToOne.class, OneToOne.class, OneToMany.class, ManyToMany.class)) {
        builder.embeddedResource(name, accessor);
    }

    // None of the above, must be @Basic or unadorned.
    else {
        builder.simpleProperty(name, accessor);
    }
}
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号