hibernate / hibernate-models

An abstraction over "reflection" and annotations
Apache License 2.0
2 stars 5 forks source link

Expose getElementType and getMapKeyType from MemberDetails #9

Closed sebersole closed 5 months ago

sebersole commented 6 months ago
    /**
     * Get the plural element type for this member.  If the member does not have a type or the
     * member is not plural, a {@code null} is returned.
     * <p/>
     * For arrays, lists and sets the element type is returned.
     * <p/>
     * For maps, the value type is returned.
     */
    TypeDetails getElementType();

    /**
     * Get the map key type for this member.  If the member does not have a type or the
     * member is not a map, a {@code null} is returned.
     */
    TypeDetails getMapKeyType()

Allows to centralize the logic needed to access these generics resolutions.

getMapKeyType is only valid for use with Map typed members. It will simply return null for all others.

sebersole commented 5 months ago

With the introduction of proper generics handling, this is no longer important.

sebersole commented 5 months ago

Reviving this. Nice to cetralize this resolution code.