Skip to content

DATAKV-206 - Support for custom identifier generators. #29

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
wants to merge 1 commit into from
Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,7 @@
* @author Oliver Gierke
* @author Thomas Darimont
* @author Mark Paluch
* @author Mert Zeybekler
*/
public class KeyValueTemplate implements KeyValueOperations, ApplicationEventPublisherAware {

Expand Down Expand Up @@ -88,6 +89,26 @@ public KeyValueTemplate(KeyValueAdapter adapter,
this.identifierGenerator = DefaultIdentifierGenerator.INSTANCE;
}

/**
* Create new {@link KeyValueTemplate} using the given {@link KeyValueAdapter} and {@link MappingContext}.
*
* @param adapter must not be {@literal null}.
* @param mappingContext must not be {@literal null}.
* @param identifierGenerator must not be {@literal null}.
*/
public KeyValueTemplate(KeyValueAdapter adapter,
MappingContext<? extends KeyValuePersistentEntity<?, ?>, ? extends KeyValuePersistentProperty<?>> mappingContext,
IdentifierGenerator identifierGenerator) {

Assert.notNull(adapter, "Adapter must not be null!");
Assert.notNull(mappingContext, "MappingContext must not be null!");
Assert.notNull(identifierGenerator, "IdentifierGenerator must not be null!");

this.adapter = adapter;
this.mappingContext = mappingContext;
this.identifierGenerator = identifierGenerator;
}

/**
* Set the {@link PersistenceExceptionTranslator} used for converting {@link RuntimeException}.
*
Expand Down