FlowingCode / backend-core

Commons utilities for back-end enterprise features
Apache License 2.0
4 stars 1 forks source link

How to document generics in commons-data #35

Open ngonzalezpazFC opened 3 years ago

ngonzalezpazFC commented 3 years ago

Interfaces in commons data have 2 parameters. Those should be the persistece layer entity and the type of its identifier. In interfaces like JpaDaoSupport or ConversionJpaDaoSupport, that implements CrudDao, the entity type parameter is replaced by the bussiness entity, because a conversion between business and persistence entities is made. How should commons-data interface entity type be documented? As the persistence or business layer entity? Or should the difference be explained in the interfaces that do conversions? (ConversionJpaDaoSupport or JpaDaoSupport)

javier-godoy commented 3 years ago

CreationDao<T, K> T is the type of the entity.

CrudDao<T, K>extends CreationDao<T, K> ... T is the type of the entity.

ConversionJpaDaoSupport<S, T extends Identifiable<K>, K extends Serializable>

T is the type of persistent entity S is the type of the service entity

JpaDaoSupport<T extends Identifiable<K>, K extends Serializable>
        extends ConversionJpaDaoSupport<T, T, K> 

T is the type of the entity.

Then in a package-level documentation we will document how "the entity" maps to S and T in different architectures.