fieldenms / tg

Trident Genesis
MIT License
14 stars 7 forks source link

EntityUtils: persistent entity type in the entity hierarchy #2247

Closed 01es closed 5 months ago

01es commented 5 months ago

Description

There are situations where it is required to obtain the first persistent entity type the hierarchy for an entity type. For example, there could be an instrumented or enhanced instances of a synthetic entity that is based on persistent, and we need to get the type of that persistent entity.

EntityUtils should be provided with method Optional<Class<? extends AbstractEntity<?>>> findFirstPersistentTypeInHierarchyFor(final Class<? extends AbstractEntity<?>> entityType) that would return the first persistent entity type of the type hierarchy for its argument entityType. The returned type could be entityType itself or the first super type that represents a persistent entity. Otherwise, an empty result should be returned.

Expected outcome

A convenient way to obtain the first persistent entity type in an entity type hierarchy.