/** * Instantiate a Builder to be able to create a {@link GenericJpaRepository} for aggregate type {@code T}. * <p> * The {@link LockFactory} is defaulted to an {@link NullLockFactory}, thus providing no additional locking, and * the {@code identifierConverter} to {@link Function#identity()}. * A goal of this Builder goal is to create an {@link AggregateModel} specifying generic {@code T} as the aggregate * type to be stored. All aggregates in this repository must be {@code instanceOf} this aggregate type. To * instantiate this AggregateModel, either an {@link AggregateModel} can be provided directly or an * {@code aggregateType} of type {@link Class} can be used. The latter will internally resolve to an AggregateModel. * Thus, either the AggregateModel <b>or</b> the {@code aggregateType} should be provided. * <p> * Additionally, the {@link EntityManagerProvider} and {@link EventBus} are <b>hard requirements</b> and as such * should be provided. * * @param <T> The type of aggregate to build the repository for * @param aggregateType The type of aggregate to build the repository for * @return a Builder to be able to create a {@link GenericJpaRepository} */ public static <T> Builder<T> builder(Class<T> aggregateType) { return new Builder<>(aggregateType); }
/** * Instantiate a Builder to be able to create a {@link GenericJpaRepository} for aggregate type {@code T}. * <p> * The {@link LockFactory} is defaulted to an {@link NullLockFactory}, thus providing no additional locking, and * the {@code identifierConverter} to {@link Function#identity()}. * A goal of this Builder goal is to create an {@link AggregateModel} specifying generic {@code T} as the aggregate * type to be stored. All aggregates in this repository must be {@code instanceOf} this aggregate type. To * instantiate this AggregateModel, either an {@link AggregateModel} can be provided directly or an * {@code aggregateType} of type {@link Class} can be used. The latter will internally resolve to an AggregateModel. * Thus, either the AggregateModel <b>or</b> the {@code aggregateType} should be provided. * <p> * Additionally, the {@link EntityManagerProvider} and {@link EventBus} are <b>hard requirements</b> and as such * should be provided. * * @param <T> The type of aggregate to build the repository for * @param aggregateType The type of aggregate to build the repository for * @return a Builder to be able to create a {@link GenericJpaRepository} */ public static <T> Builder<T> builder(Class<T> aggregateType) { return new Builder<>(aggregateType); }