DATAKV-206 - Support for custom identifier generators.
Original pull request: #29.
This commit is contained in:
@@ -46,6 +46,7 @@ import org.springframework.util.CollectionUtils;
|
||||
* @author Oliver Gierke
|
||||
* @author Thomas Darimont
|
||||
* @author Mark Paluch
|
||||
* @author Mert Zeybekler
|
||||
*/
|
||||
public class KeyValueTemplate implements KeyValueOperations, ApplicationEventPublisherAware {
|
||||
|
||||
@@ -88,6 +89,26 @@ public class KeyValueTemplate implements KeyValueOperations, ApplicationEventPub
|
||||
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}.
|
||||
*
|
||||
|
||||
Reference in New Issue
Block a user