Interface DataModelContributor

All Known Implementing Classes:
DynamicModelDataModelContributor

@NullMarked public interface DataModelContributor
Describes entities and attributes that JPA metadata cannot describe, so that they take part in the data model. Implementations are consulted in bean order. For describeEntity(MetaClass) and describeAttribute(MetaClass, MetaProperty) the first one that handles an object wins; the entities of getAdditionalEntities() are collected from all implementations and de-duplicated by entity name.

An implementation is expected not to throw: a call that fails is logged and skipped, and whatever that implementation would have contributed is missing from the data model.

  • Method Details

    • getAdditionalEntities

      default Collection<MetaClass> getAdditionalEntities()
      Returns entities to add to the data model in addition to JPA entities. The result is added to what the other implementations return, so an entity already in the model is not added twice.
      Returns:
      contributed entity meta-classes, empty if none
    • describeEntity

      default @Nullable EntityDescriptor describeEntity(MetaClass metaClass)
      Describes the physical placement of an entity.
      Parameters:
      metaClass - entity meta-class
      Returns:
      descriptor, or null if this contributor does not handle the entity
    • describeAttribute

      default @Nullable AttributeDescriptor describeAttribute(MetaClass entity, MetaProperty property)
      Describes a property that is not a JPA attribute.
      Parameters:
      entity - owner entity meta-class
      property - property to describe
      Returns:
      descriptor, or null if this contributor does not handle the property