EntityClass.java 文件源码

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

项目:org.fastnate 作者:
/**
 * Builds the property for the given attribute.
 *
 * @param attribute
 *            the attribute to inspect
 * @param columnMetadata
 *            the attached (or overriden) column metadata
 * @param override
 *            the AssociationOverride found for this attribute
 * @return the property that represents the attribute or {@code null} if not persistent
 */
<X> Property<X, ?> buildProperty(final AttributeAccessor attribute, final Column columnMetadata,
        final AssociationOverride override) {
    if (attribute.isPersistent()) {
        if (CollectionProperty.isCollectionProperty(attribute)) {
            return new CollectionProperty<>(this, attribute, override);
        } else if (MapProperty.isMapProperty(attribute)) {
            return new MapProperty<>(this, attribute, override);
        } else if (EntityProperty.isEntityProperty(attribute)) {
            return new EntityProperty<>(this.context, getTable(), attribute, override);
        } else if (attribute.isAnnotationPresent(Embedded.class)) {
            return new EmbeddedProperty<>(this, attribute);
        } else if (attribute.isAnnotationPresent(Version.class)) {
            return new VersionProperty<>(this.context, this.table, attribute, columnMetadata);
        } else {
            return new PrimitiveProperty<>(this.context, this.table, attribute, columnMetadata);
        }
    }
    return null;
}
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号