diff --git a/pom.xml b/pom.xml
index 3f916810..a713fa1a 100644
--- a/pom.xml
+++ b/pom.xml
@@ -5,7 +5,7 @@
org.springframework.data
spring-data-keyvalue
- 2.0.0.BUILD-SNAPSHOT
+ 2.0.0.DATAKV-187-SNAPSHOT
Spring Data KeyValue
diff --git a/src/main/java/org/springframework/data/keyvalue/core/AbstractKeyValueAdapter.java b/src/main/java/org/springframework/data/keyvalue/core/AbstractKeyValueAdapter.java
index dc626fce..08a98e9c 100644
--- a/src/main/java/org/springframework/data/keyvalue/core/AbstractKeyValueAdapter.java
+++ b/src/main/java/org/springframework/data/keyvalue/core/AbstractKeyValueAdapter.java
@@ -15,7 +15,6 @@
*/
package org.springframework.data.keyvalue.core;
-import java.io.Serializable;
import java.util.Collection;
import org.springframework.data.keyvalue.core.query.KeyValueQuery;
@@ -59,46 +58,46 @@ protected AbstractKeyValueAdapter(QueryEngine extends KeyValueAdapter, ?, ?> e
/*
* (non-Javadoc)
- * @see org.springframework.data.keyvalue.core.KeyValueAdapter#get(java.io.Serializable, java.io.Serializable, java.lang.Class)
+ * @see org.springframework.data.keyvalue.core.KeyValueAdapter#get(java.lang.Object, java.lang.String, java.lang.Class)
*/
@Override
- public T get(Serializable id, Serializable keyspace, Class type) {
+ public T get(Object id, String keyspace, Class type) {
return (T) get(id, keyspace);
}
/*
* (non-Javadoc)
- * @see org.springframework.data.keyvalue.core.KeyValueAdapter#get(java.io.Serializable, java.io.Serializable, java.lang.Class)
+ * @see org.springframework.data.keyvalue.core.KeyValueAdapter#delete(java.lang.Object, java.lang.String, java.lang.Class)
*/
@Override
- public T delete(Serializable id, Serializable keyspace, Class type) {
+ public T delete(Object id, String keyspace, Class type) {
return (T) delete(id, keyspace);
}
/*
* (non-Javadoc)
- * @see org.springframework.data.keyvalue.core.KeyValueAdapter#get(java.io.Serializable, java.io.Serializable, java.lang.Class)
+ * @see org.springframework.data.keyvalue.core.KeyValueAdapter#find(org.springframework.data.keyvalue.core.query.KeyValueQuery, java.lang.String, java.lang.Class)
*/
@Override
- public Iterable find(KeyValueQuery> query, Serializable keyspace, Class type) {
+ public Iterable find(KeyValueQuery> query, String keyspace, Class type) {
return engine.execute(query, keyspace, type);
}
/*
* (non-Javadoc)
- * @see org.springframework.data.keyvalue.core.KeyValueAdapter#find(org.springframework.data.keyvalue.core.query.KeyValueQuery, java.io.Serializable)
+ * @see org.springframework.data.keyvalue.core.KeyValueAdapter#find(org.springframework.data.keyvalue.core.query.KeyValueQuery, java.lang.String)
*/
@Override
- public Collection> find(KeyValueQuery> query, Serializable keyspace) {
+ public Collection> find(KeyValueQuery> query, String keyspace) {
return engine.execute(query, keyspace);
}
/*
* (non-Javadoc)
- * @see org.springframework.data.keyvalue.core.KeyValueAdapter#count(org.springframework.data.keyvalue.core.query.KeyValueQuery, java.io.Serializable)
+ * @see org.springframework.data.keyvalue.core.KeyValueAdapter#count(org.springframework.data.keyvalue.core.query.KeyValueQuery, java.lang.String)
*/
@Override
- public long count(KeyValueQuery> query, Serializable keyspace) {
+ public long count(KeyValueQuery> query, String keyspace) {
return engine.count(query, keyspace);
}
}
diff --git a/src/main/java/org/springframework/data/keyvalue/core/KeyValueAdapter.java b/src/main/java/org/springframework/data/keyvalue/core/KeyValueAdapter.java
index a3bc9347..15c906e9 100644
--- a/src/main/java/org/springframework/data/keyvalue/core/KeyValueAdapter.java
+++ b/src/main/java/org/springframework/data/keyvalue/core/KeyValueAdapter.java
@@ -1,5 +1,5 @@
/*
- * Copyright 2014-2016 the original author or authors.
+ * Copyright 2014-2017 the original author or authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -15,7 +15,6 @@
*/
package org.springframework.data.keyvalue.core;
-import java.io.Serializable;
import java.util.Collection;
import java.util.Map;
@@ -38,7 +37,7 @@ public interface KeyValueAdapter extends DisposableBean {
* @param keyspace must not be {@literal null}.
* @return the item previously associated with the id.
*/
- Object put(Serializable id, Object item, Serializable keyspace);
+ Object put(Object id, Object item, String keyspace);
/**
* Check if a object with given id exists in keyspace.
@@ -47,7 +46,7 @@ public interface KeyValueAdapter extends DisposableBean {
* @param keyspace must not be {@literal null}.
* @return true if item of type with id exists.
*/
- boolean contains(Serializable id, Serializable keyspace);
+ boolean contains(Object id, String keyspace);
/**
* Get the object with given id from keyspace.
@@ -56,7 +55,7 @@ public interface KeyValueAdapter extends DisposableBean {
* @param keyspace must not be {@literal null}.
* @return {@literal null} in case no matching item exists.
*/
- Object get(Serializable id, Serializable keyspace);
+ Object get(Object id, String keyspace);
/**
* @param id
@@ -65,7 +64,7 @@ public interface KeyValueAdapter extends DisposableBean {
* @return
* @since 1.1
*/
- T get(Serializable id, Serializable keyspace, Class type);
+ T get(Object id, String keyspace, Class type);
/**
* Delete and return the obect with given type and id.
@@ -74,7 +73,7 @@ public interface KeyValueAdapter extends DisposableBean {
* @param keyspace must not be {@literal null}.
* @return {@literal null} if object could not be found
*/
- Object delete(Serializable id, Serializable keyspace);
+ Object delete(Object id, String keyspace);
/**
* @param id
@@ -83,7 +82,7 @@ public interface KeyValueAdapter extends DisposableBean {
* @return
* @since 1.1
*/
- T delete(Serializable id, Serializable keyspace, Class type);
+ T delete(Object id, String keyspace, Class type);
/**
* Get all elements for given keyspace.
@@ -91,7 +90,7 @@ public interface KeyValueAdapter extends DisposableBean {
* @param keyspace must not be {@literal null}.
* @return empty {@link Collection} if nothing found.
*/
- Iterable> getAllOf(Serializable keyspace);
+ Iterable> getAllOf(String keyspace);
/**
* Returns a {@link CloseableIterator} that iterates over all entries.
@@ -99,14 +98,14 @@ public interface KeyValueAdapter extends DisposableBean {
* @param keyspace
* @return
*/
- CloseableIterator> entries(Serializable keyspace);
+ CloseableIterator> entries(String keyspace);
/**
* Remove all objects of given type.
*
* @param keyspace must not be {@literal null}.
*/
- void deleteAllOf(Serializable keyspace);
+ void deleteAllOf(String keyspace);
/**
* Removes all objects.
@@ -120,7 +119,7 @@ public interface KeyValueAdapter extends DisposableBean {
* @param keyspace must not be {@literal null}.
* @return empty {@link Collection} if no match found.
*/
- Iterable> find(KeyValueQuery> query, Serializable keyspace);
+ Iterable> find(KeyValueQuery> query, String keyspace);
/**
* @param query
@@ -129,14 +128,14 @@ public interface KeyValueAdapter extends DisposableBean {
* @return
* @since 1.1
*/
- Iterable find(KeyValueQuery> query, Serializable keyspace, Class type);
+ Iterable find(KeyValueQuery> query, String keyspace, Class type);
/**
* Count number of objects within {@literal keyspace}.
*
* @param keyspace must not be {@literal null}.
*/
- long count(Serializable keyspace);
+ long count(String keyspace);
/**
* Count all matching objects within {@literal keyspace}.
@@ -145,5 +144,5 @@ public interface KeyValueAdapter extends DisposableBean {
* @param keyspace must not be {@literal null}.
* @return
*/
- long count(KeyValueQuery> query, Serializable keyspace);
+ long count(KeyValueQuery> query, String keyspace);
}
diff --git a/src/main/java/org/springframework/data/keyvalue/core/KeyValueOperations.java b/src/main/java/org/springframework/data/keyvalue/core/KeyValueOperations.java
index a16493b0..ae68d76c 100644
--- a/src/main/java/org/springframework/data/keyvalue/core/KeyValueOperations.java
+++ b/src/main/java/org/springframework/data/keyvalue/core/KeyValueOperations.java
@@ -1,5 +1,5 @@
/*
- * Copyright 2014 the original author or authors.
+ * Copyright 2014-2017 the original author or authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -15,7 +15,6 @@
*/
package org.springframework.data.keyvalue.core;
-import java.io.Serializable;
import java.util.Optional;
import org.springframework.beans.factory.DisposableBean;
@@ -45,7 +44,7 @@ public interface KeyValueOperations extends DisposableBean {
* @param id must not be {@literal null}.
* @param objectToInsert must not be {@literal null}.
*/
- void insert(Serializable id, Object objectToInsert);
+ void insert(Object id, Object objectToInsert);
/**
* Get all elements of given type. Respects {@link KeySpace} if present and therefore returns all elements that can be
@@ -74,7 +73,7 @@ public interface KeyValueOperations extends DisposableBean {
* @param type must not be {@literal null}.
* @return null if not found.
*/
- Optional findById(Serializable id, Class type);
+ Optional findById(Object id, Class type);
/**
* Execute operation against underlying store.
@@ -126,7 +125,7 @@ public interface KeyValueOperations extends DisposableBean {
* @param id must not be {@literal null}.
* @param objectToUpdate must not be {@literal null}.
*/
- void update(Serializable id, Object objectToUpdate);
+ void update(Object id, Object objectToUpdate);
/**
* Remove all elements of type. Respects {@link KeySpace} if present and therefore removes all elements that can be
@@ -149,7 +148,7 @@ public interface KeyValueOperations extends DisposableBean {
* @param type must not be {@literal null}.
* @return the deleted item or {@literal null} if no match found.
*/
- T delete(Serializable id, Class type);
+ T delete(Object id, Class type);
/**
* Total number of elements with given type available. Respects {@link KeySpace} if present and therefore counts all
diff --git a/src/main/java/org/springframework/data/keyvalue/core/KeyValueTemplate.java b/src/main/java/org/springframework/data/keyvalue/core/KeyValueTemplate.java
index 6238fb67..85b1193f 100644
--- a/src/main/java/org/springframework/data/keyvalue/core/KeyValueTemplate.java
+++ b/src/main/java/org/springframework/data/keyvalue/core/KeyValueTemplate.java
@@ -15,7 +15,6 @@
*/
package org.springframework.data.keyvalue.core;
-import java.io.Serializable;
import java.util.ArrayList;
import java.util.Collections;
import java.util.List;
@@ -38,7 +37,6 @@
import org.springframework.util.Assert;
import org.springframework.util.ClassUtils;
import org.springframework.util.CollectionUtils;
-import org.springframework.util.ObjectUtils;
/**
* Basic implementation of {@link KeyValueOperations}.
@@ -135,11 +133,10 @@ public T insert(T objectToInsert) {
KeyValuePersistentEntity, ?> entity = getKeyValuePersistentEntity(objectToInsert);
GeneratingIdAccessor generatingIdAccessor = new GeneratingIdAccessor(entity.getPropertyAccessor(objectToInsert),
- entity.getIdProperty(),
- identifierGenerator);
+ entity.getIdProperty(), identifierGenerator);
Object id = generatingIdAccessor.getOrGenerateIdentifier();
- insert((Serializable) id, objectToInsert);
+ insert(id, objectToInsert);
return objectToInsert;
}
@@ -149,10 +146,10 @@ public T insert(T objectToInsert) {
/*
* (non-Javadoc)
- * @see org.springframework.data.keyvalue.core.KeyValueOperations#insert(java.io.Serializable, java.lang.Object)
+ * @see org.springframework.data.keyvalue.core.KeyValueOperations#insert(java.lang.Object, java.lang.Object)
*/
@Override
- public void insert(final Serializable id, final Object objectToInsert) {
+ public void insert(final Object id, final Object objectToInsert) {
Assert.notNull(id, "Id for object to be inserted must not be null!");
Assert.notNull(objectToInsert, "Object to be inserted must not be null!");
@@ -194,15 +191,15 @@ public void update(Object objectToUpdate) {
String.format("Cannot determine id for type %s", ClassUtils.getUserClass(objectToUpdate)));
}
- update((Serializable) entity.getIdentifierAccessor(objectToUpdate).getRequiredIdentifier(), objectToUpdate);
+ update(entity.getIdentifierAccessor(objectToUpdate).getRequiredIdentifier(), objectToUpdate);
}
/*
* (non-Javadoc)
- * @see org.springframework.data.keyvalue.core.KeyValueOperations#update(java.io.Serializable, java.lang.Object)
+ * @see org.springframework.data.keyvalue.core.KeyValueOperations#update(java.lang.Object, java.lang.Object)
*/
@Override
- public void update(final Serializable id, final Object objectToUpdate) {
+ public void update(final Object id, final Object objectToUpdate) {
Assert.notNull(id, "Id for object to be inserted must not be null!");
Assert.notNull(objectToUpdate, "Object to be updated must not be null!");
@@ -258,10 +255,10 @@ public Iterable doInKeyValue(KeyValueAdapter adapter) {
/*
* (non-Javadoc)
- * @see org.springframework.data.keyvalue.core.KeyValueOperations#findById(java.io.Serializable, java.lang.Class)
+ * @see org.springframework.data.keyvalue.core.KeyValueOperations#findById(java.lang.Object, java.lang.Class)
*/
@Override
- public Optional findById(final Serializable id, final Class type) {
+ public Optional findById(final Object id, final Class type) {
Assert.notNull(id, "Id for object to be inserted must not be null!");
Assert.notNull(type, "Type to fetch must not be null!");
@@ -328,15 +325,15 @@ public T delete(T objectToDelete) {
Class type = (Class) ClassUtils.getUserClass(objectToDelete);
KeyValuePersistentEntity, ?> entity = getKeyValuePersistentEntity(objectToDelete);
- return delete((Serializable) entity.getIdentifierAccessor(objectToDelete).getIdentifier(), type);
+ return delete(entity.getIdentifierAccessor(objectToDelete).getIdentifier(), type);
}
/*
* (non-Javadoc)
- * @see org.springframework.data.keyvalue.core.KeyValueOperations#delete(java.io.Serializable, java.lang.Class)
+ * @see org.springframework.data.keyvalue.core.KeyValueOperations#delete(java.lang.Object, java.lang.Class)
*/
@Override
- public T delete(final Serializable id, final Class type) {
+ public T delete(final Object id, final Class type) {
Assert.notNull(id, "Id for object to be deleted must not be null!");
Assert.notNull(type, "Type to delete must not be null!");
diff --git a/src/main/java/org/springframework/data/keyvalue/core/QueryEngine.java b/src/main/java/org/springframework/data/keyvalue/core/QueryEngine.java
index fce93580..85c9b64c 100644
--- a/src/main/java/org/springframework/data/keyvalue/core/QueryEngine.java
+++ b/src/main/java/org/springframework/data/keyvalue/core/QueryEngine.java
@@ -1,5 +1,5 @@
/*
- * Copyright 2014-2016 the original author or authors.
+ * Copyright 2014-2017 the original author or authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -15,7 +15,6 @@
*/
package org.springframework.data.keyvalue.core;
-import java.io.Serializable;
import java.util.Collection;
import org.springframework.data.keyvalue.core.query.KeyValueQuery;
@@ -48,7 +47,7 @@ public QueryEngine(CriteriaAccessor criteriaAccessor, SortAccessor execute(KeyValueQuery> query, Serializable keyspace) {
+ public Collection> execute(KeyValueQuery> query, String keyspace) {
CRITERIA criteria = this.criteriaAccessor != null ? this.criteriaAccessor.resolve(query) : null;
SORT sort = this.sortAccessor != null ? this.sortAccessor.resolve(query) : null;
@@ -63,7 +62,7 @@ public Collection> execute(KeyValueQuery> query, Serializable keyspace) {
* @param keyspace
* @return
*/
- public Collection execute(KeyValueQuery> query, Serializable keyspace, Class type) {
+ public Collection execute(KeyValueQuery> query, String keyspace, Class type) {
CRITERIA criteria = this.criteriaAccessor != null ? this.criteriaAccessor.resolve(query) : null;
SORT sort = this.sortAccessor != null ? this.sortAccessor.resolve(query) : null;
@@ -78,7 +77,7 @@ public Collection execute(KeyValueQuery> query, Serializable keyspace,
* @param keyspace
* @return
*/
- public long count(KeyValueQuery> query, Serializable keyspace) {
+ public long count(KeyValueQuery> query, String keyspace) {
CRITERIA criteria = this.criteriaAccessor != null ? this.criteriaAccessor.resolve(query) : null;
return count(criteria, keyspace);
@@ -92,7 +91,7 @@ public long count(KeyValueQuery> query, Serializable keyspace) {
* @param keyspace
* @return
*/
- public abstract Collection> execute(CRITERIA criteria, SORT sort, long offset, int rows, Serializable keyspace);
+ public abstract Collection> execute(CRITERIA criteria, SORT sort, long offset, int rows, String keyspace);
/**
* @param criteria
@@ -104,7 +103,7 @@ public long count(KeyValueQuery> query, Serializable keyspace) {
* @return
* @since 1.1
*/
- public Collection execute(CRITERIA criteria, SORT sort, long offset, int rows, Serializable keyspace,
+ public Collection execute(CRITERIA criteria, SORT sort, long offset, int rows, String keyspace,
Class type) {
return (Collection) execute(criteria, sort, offset, rows, keyspace);
}
@@ -114,7 +113,7 @@ public Collection execute(CRITERIA criteria, SORT sort, long offset, int
* @param keyspace
* @return
*/
- public abstract long count(CRITERIA criteria, Serializable keyspace);
+ public abstract long count(CRITERIA criteria, String keyspace);
/**
* Get the {@link KeyValueAdapter} used.
diff --git a/src/main/java/org/springframework/data/keyvalue/core/SpelQueryEngine.java b/src/main/java/org/springframework/data/keyvalue/core/SpelQueryEngine.java
index b553054c..e0497647 100644
--- a/src/main/java/org/springframework/data/keyvalue/core/SpelQueryEngine.java
+++ b/src/main/java/org/springframework/data/keyvalue/core/SpelQueryEngine.java
@@ -15,7 +15,6 @@
*/
package org.springframework.data.keyvalue.core;
-import java.io.Serializable;
import java.util.ArrayList;
import java.util.Collection;
import java.util.Collections;
@@ -48,19 +47,19 @@ public SpelQueryEngine() {
/*
* (non-Javadoc)
- * @see org.springframework.data.keyvalue.core.QueryEngine#execute(java.lang.Object, java.lang.Object, int, int, java.io.Serializable)
+ * @see org.springframework.data.keyvalue.core.QueryEngine#execute(java.lang.Object, java.lang.Object, int, int, java.lang.String)
*/
@Override
- public Collection> execute(SpelCriteria criteria, Comparator> sort, long offset, int rows, Serializable keyspace) {
+ public Collection> execute(SpelCriteria criteria, Comparator> sort, long offset, int rows, String keyspace) {
return sortAndFilterMatchingRange(getAdapter().getAllOf(keyspace), criteria, sort, offset, rows);
}
/*
* (non-Javadoc)
- * @see org.springframework.data.keyvalue.core.QueryEngine#count(java.lang.Object, java.io.Serializable)
+ * @see org.springframework.data.keyvalue.core.QueryEngine#count(java.lang.Object, java.lang.String)
*/
@Override
- public long count(SpelCriteria criteria, Serializable keyspace) {
+ public long count(SpelCriteria criteria, String keyspace) {
return filterMatchingRange(getAdapter().getAllOf(keyspace), criteria, -1, -1).size();
}
@@ -93,8 +92,8 @@ private static List filterMatchingRange(Iterable source, SpelCriteria
matches = criteria.getExpression().getValue(criteria.getContext(), candidate, Boolean.class);
} catch (SpelEvaluationException e) {
criteria.getContext().setVariable("it", candidate);
- matches = criteria.getExpression().getValue(criteria.getContext()) == null ? false : criteria.getExpression()
- .getValue(criteria.getContext(), Boolean.class);
+ matches = criteria.getExpression().getValue(criteria.getContext()) == null ? false
+ : criteria.getExpression().getValue(criteria.getContext(), Boolean.class);
}
}
diff --git a/src/main/java/org/springframework/data/keyvalue/core/event/KeyValueEvent.java b/src/main/java/org/springframework/data/keyvalue/core/event/KeyValueEvent.java
index daba6d4e..67a71d3e 100644
--- a/src/main/java/org/springframework/data/keyvalue/core/event/KeyValueEvent.java
+++ b/src/main/java/org/springframework/data/keyvalue/core/event/KeyValueEvent.java
@@ -15,8 +15,6 @@
*/
package org.springframework.data.keyvalue.core.event;
-import java.io.Serializable;
-
import org.springframework.context.ApplicationEvent;
/**
@@ -60,7 +58,7 @@ public String toString() {
* @param type
* @return
*/
- public static BeforeGetEvent beforeGet(Serializable id, String keySpace, Class type) {
+ public static BeforeGetEvent beforeGet(Object id, String keySpace, Class type) {
return new BeforeGetEvent<>(id, keySpace, type);
}
@@ -73,7 +71,7 @@ public static BeforeGetEvent beforeGet(Serializable id, String keySpace,
* @param value
* @return
*/
- public static AfterGetEvent afterGet(Serializable id, String keySpace, Class type, T value) {
+ public static AfterGetEvent afterGet(Object id, String keySpace, Class type, T value) {
return new AfterGetEvent<>(id, keySpace, type, value);
}
@@ -86,7 +84,7 @@ public static AfterGetEvent afterGet(Serializable id, String keySpace, Cl
* @param value
* @return
*/
- public static BeforeInsertEvent beforeInsert(Serializable id, String keySpace, Class extends T> type, T value) {
+ public static BeforeInsertEvent beforeInsert(Object id, String keySpace, Class extends T> type, T value) {
return new BeforeInsertEvent<>(id, keySpace, type, value);
}
@@ -99,7 +97,7 @@ public static BeforeInsertEvent beforeInsert(Serializable id, String keyS
* @param value
* @return
*/
- public static AfterInsertEvent afterInsert(Serializable id, String keySpace, Class extends T> type, T value) {
+ public static AfterInsertEvent afterInsert(Object id, String keySpace, Class extends T> type, T value) {
return new AfterInsertEvent<>(id, keySpace, type, value);
}
@@ -112,7 +110,7 @@ public static AfterInsertEvent afterInsert(Serializable id, String keySpa
* @param value
* @return
*/
- public static BeforeUpdateEvent beforeUpdate(Serializable id, String keySpace, Class extends T> type, T value) {
+ public static BeforeUpdateEvent beforeUpdate(Object id, String keySpace, Class extends T> type, T value) {
return new BeforeUpdateEvent<>(id, keySpace, type, value);
}
@@ -126,8 +124,8 @@ public static BeforeUpdateEvent beforeUpdate(Serializable id, String keyS
* @param previousValue
* @return
*/
- public static AfterUpdateEvent afterUpdate(Serializable id, String keySpace, Class extends T> type,
- T actualValue, Object previousValue) {
+ public static AfterUpdateEvent afterUpdate(Object id, String keySpace, Class extends T> type, T actualValue,
+ Object previousValue) {
return new AfterUpdateEvent<>(id, keySpace, type, actualValue, previousValue);
}
@@ -161,7 +159,7 @@ public static AfterDropKeySpaceEvent afterDropKeySpace(String keySpace, C
* @param type
* @return
*/
- public static BeforeDeleteEvent beforeDelete(Serializable id, String keySpace, Class extends T> type) {
+ public static BeforeDeleteEvent beforeDelete(Object id, String keySpace, Class extends T> type) {
return new BeforeDeleteEvent<>(id, keySpace, type);
}
@@ -174,7 +172,7 @@ public static BeforeDeleteEvent beforeDelete(Serializable id, String keyS
* @param value
* @return
*/
- public static AfterDeleteEvent afterDelete(Serializable id, String keySpace, Class extends T> type, T value) {
+ public static AfterDeleteEvent afterDelete(Object id, String keySpace, Class extends T> type, T value) {
return new AfterDeleteEvent<>(id, keySpace, type, value);
}
@@ -185,16 +183,17 @@ public static AfterDeleteEvent afterDelete(Serializable id, String keySpa
@SuppressWarnings("serial")
abstract static class KeyBasedEvent extends KeyValueEvent {
- private Serializable key;
+ private Object key;
private Class extends T> type;
- protected KeyBasedEvent(Serializable key, String keySpace, Class extends T> type) {
+ protected KeyBasedEvent(Object key, String keySpace, Class extends T> type) {
super(type, keySpace);
this.key = key;
+ this.type = type;
}
- public Serializable getKey() {
+ public Object getKey() {
return key;
}
@@ -203,7 +202,7 @@ public Serializable getKey() {
* @see java.util.EventObject#getSource()
*/
@Override
- public Serializable getSource() {
+ public Object getSource() {
return getKey();
}
@@ -226,7 +225,7 @@ abstract static class KeyBasedEventWithPayload extends KeyBasedEvent {
private final T payload;
- public KeyBasedEventWithPayload(Serializable key, String keySpace, Class extends T> type, T payload) {
+ public KeyBasedEventWithPayload(Object key, String keySpace, Class extends T> type, T payload) {
super(key, keySpace, type);
this.payload = payload;
}
@@ -250,7 +249,7 @@ public T getPayload() {
@SuppressWarnings("serial")
public static class BeforeGetEvent extends KeyBasedEvent {
- protected BeforeGetEvent(Serializable key, String keySpace, Class type) {
+ protected BeforeGetEvent(Object key, String keySpace, Class type) {
super(key, keySpace, type);
}
@@ -265,7 +264,7 @@ protected BeforeGetEvent(Serializable key, String keySpace, Class type) {
@SuppressWarnings("serial")
public static class AfterGetEvent extends KeyBasedEventWithPayload {
- protected AfterGetEvent(Serializable key, String keyspace, Class type, T payload) {
+ protected AfterGetEvent(Object key, String keyspace, Class type, T payload) {
super(key, keyspace, type, payload);
}
@@ -280,7 +279,7 @@ protected AfterGetEvent(Serializable key, String keyspace, Class type, T payl
@SuppressWarnings("serial")
public static class BeforeInsertEvent extends KeyBasedEventWithPayload {
- public BeforeInsertEvent(Serializable key, String keySpace, Class extends T> type, T payload) {
+ public BeforeInsertEvent(Object key, String keySpace, Class extends T> type, T payload) {
super(key, keySpace, type, payload);
}
@@ -295,7 +294,7 @@ public BeforeInsertEvent(Serializable key, String keySpace, Class extends T> t
@SuppressWarnings("serial")
public static class AfterInsertEvent extends KeyBasedEventWithPayload {
- public AfterInsertEvent(Serializable key, String keySpace, Class extends T> type, T payload) {
+ public AfterInsertEvent(Object key, String keySpace, Class extends T> type, T payload) {
super(key, keySpace, type, payload);
}
}
@@ -309,7 +308,7 @@ public AfterInsertEvent(Serializable key, String keySpace, Class extends T> ty
@SuppressWarnings("serial")
public static class BeforeUpdateEvent extends KeyBasedEventWithPayload {
- public BeforeUpdateEvent(Serializable key, String keySpace, Class extends T> type, T payload) {
+ public BeforeUpdateEvent(Object key, String keySpace, Class extends T> type, T payload) {
super(key, keySpace, type, payload);
}
}
@@ -325,7 +324,7 @@ public static class AfterUpdateEvent extends KeyBasedEventWithPayload {
private final Object existing;
- public AfterUpdateEvent(Serializable key, String keySpace, Class extends T> type, T payload, Object existing) {
+ public AfterUpdateEvent(Object key, String keySpace, Class extends T> type, T payload, Object existing) {
super(key, keySpace, type, payload);
this.existing = existing;
}
@@ -358,7 +357,7 @@ public T after() {
@SuppressWarnings("serial")
public static class BeforeDeleteEvent extends KeyBasedEvent {
- public BeforeDeleteEvent(Serializable key, String keySpace, Class extends T> type) {
+ public BeforeDeleteEvent(Object key, String keySpace, Class extends T> type) {
super(key, keySpace, type);
}
}
@@ -372,7 +371,7 @@ public BeforeDeleteEvent(Serializable key, String keySpace, Class extends T> t
@SuppressWarnings("serial")
public static class AfterDeleteEvent extends KeyBasedEventWithPayload {
- public AfterDeleteEvent(Serializable key, String keySpace, Class extends T> type, T payload) {
+ public AfterDeleteEvent(Object key, String keySpace, Class extends T> type, T payload) {
super(key, keySpace, type, payload);
}
}
diff --git a/src/main/java/org/springframework/data/keyvalue/repository/KeyValueRepository.java b/src/main/java/org/springframework/data/keyvalue/repository/KeyValueRepository.java
index 50e3a11d..3d9678bc 100644
--- a/src/main/java/org/springframework/data/keyvalue/repository/KeyValueRepository.java
+++ b/src/main/java/org/springframework/data/keyvalue/repository/KeyValueRepository.java
@@ -1,5 +1,5 @@
/*
- * Copyright 2014 the original author or authors.
+ * Copyright 2014-2017 the original author or authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -15,8 +15,6 @@
*/
package org.springframework.data.keyvalue.repository;
-import java.io.Serializable;
-
import org.springframework.data.repository.PagingAndSortingRepository;
/**
@@ -24,6 +22,6 @@
* @param
* @param
*/
-public interface KeyValueRepository extends PagingAndSortingRepository {
+public interface KeyValueRepository extends PagingAndSortingRepository {
}
diff --git a/src/main/java/org/springframework/data/keyvalue/repository/support/SimpleKeyValueRepository.java b/src/main/java/org/springframework/data/keyvalue/repository/support/SimpleKeyValueRepository.java
index 2cc4e4fd..38493429 100644
--- a/src/main/java/org/springframework/data/keyvalue/repository/support/SimpleKeyValueRepository.java
+++ b/src/main/java/org/springframework/data/keyvalue/repository/support/SimpleKeyValueRepository.java
@@ -15,7 +15,6 @@
*/
package org.springframework.data.keyvalue.repository.support;
-import java.io.Serializable;
import java.util.ArrayList;
import java.util.List;
import java.util.Optional;
@@ -38,7 +37,7 @@
* @param
* @param
*/
-public class SimpleKeyValueRepository implements KeyValueRepository {
+public class SimpleKeyValueRepository implements KeyValueRepository {
private final KeyValueOperations operations;
private final EntityInformation entityInformation;
diff --git a/src/main/java/org/springframework/data/map/MapKeyValueAdapter.java b/src/main/java/org/springframework/data/map/MapKeyValueAdapter.java
index b2628e36..d268c023 100644
--- a/src/main/java/org/springframework/data/map/MapKeyValueAdapter.java
+++ b/src/main/java/org/springframework/data/map/MapKeyValueAdapter.java
@@ -15,7 +15,6 @@
*/
package org.springframework.data.map;
-import java.io.Serializable;
import java.util.Collection;
import java.util.Map;
import java.util.Map.Entry;
@@ -36,9 +35,9 @@
*/
public class MapKeyValueAdapter extends AbstractKeyValueAdapter {
- @SuppressWarnings("rawtypes")//
+ @SuppressWarnings("rawtypes") //
private final Class extends Map> keySpaceMapType;
- private final Map> store;
+ private final Map> store;
/**
* Create new {@link MapKeyValueAdapter} using {@link ConcurrentHashMap} as backing store type.
@@ -54,7 +53,7 @@ public MapKeyValueAdapter() {
*/
@SuppressWarnings("rawtypes")
public MapKeyValueAdapter(Class extends Map> mapType) {
- this(CollectionFactory.> createMap(mapType, 100), mapType);
+ this(CollectionFactory.createMap(mapType, 100), mapType);
}
/**
@@ -63,7 +62,7 @@ public MapKeyValueAdapter(Class extends Map> mapType) {
* @param store must not be {@literal null}.
*/
@SuppressWarnings({ "rawtypes", "unchecked" })
- public MapKeyValueAdapter(Map> store) {
+ public MapKeyValueAdapter(Map> store) {
this(store, (Class extends Map>) ClassUtils.getUserClass(store));
}
@@ -74,7 +73,7 @@ public MapKeyValueAdapter(Map> store) {
* @param keySpaceMapType must not be {@literal null}.
*/
@SuppressWarnings("rawtypes")
- private MapKeyValueAdapter(Map> store, Class extends Map> keySpaceMapType) {
+ private MapKeyValueAdapter(Map> store, Class extends Map> keySpaceMapType) {
Assert.notNull(store, "Store must not be null.");
Assert.notNull(keySpaceMapType, "Map type to be used for key spaces must not be null!");
@@ -85,10 +84,10 @@ private MapKeyValueAdapter(Map> store, C
/*
* (non-Javadoc)
- * @see org.springframework.data.keyvalue.core.KeyValueAdapter#put(java.io.Serializable, java.lang.Object, java.io.Serializable)
+ * @see org.springframework.data.keyvalue.core.KeyValueAdapter#put(java.lang.Object, java.lang.Object, java.lang.String)
*/
@Override
- public Object put(Serializable id, Object item, Serializable keyspace) {
+ public Object put(Object id, Object item, String keyspace) {
Assert.notNull(id, "Cannot add item with null id.");
Assert.notNull(keyspace, "Cannot add item for null collection.");
@@ -98,27 +97,27 @@ public Object put(Serializable id, Object item, Serializable keyspace) {
/*
* (non-Javadoc)
- * @see org.springframework.data.keyvalue.core.KeyValueAdapter#contains(java.io.Serializable, java.io.Serializable)
+ * @see org.springframework.data.keyvalue.core.KeyValueAdapter#contains(java.lang.Object, java.lang.String)
*/
@Override
- public boolean contains(Serializable id, Serializable keyspace) {
+ public boolean contains(Object id, String keyspace) {
return get(id, keyspace) != null;
}
/* (non-Javadoc)
- * @see org.springframework.data.keyvalue.core.KeyValueAdapter#count(java.io.Serializable)
+ * @see org.springframework.data.keyvalue.core.KeyValueAdapter#count(java.lang.String)
*/
@Override
- public long count(Serializable keyspace) {
+ public long count(String keyspace) {
return getKeySpaceMap(keyspace).size();
}
/*
* (non-Javadoc)
- * @see org.springframework.data.keyvalue.core.KeyValueAdapter#get(java.io.Serializable, java.io.Serializable)
+ * @see org.springframework.data.keyvalue.core.KeyValueAdapter#get(java.lang.Object, java.lang.String)
*/
@Override
- public Object get(Serializable id, Serializable keyspace) {
+ public Object get(Object id, String keyspace) {
Assert.notNull(id, "Cannot get item with null id.");
return getKeySpaceMap(keyspace).get(id);
@@ -126,10 +125,10 @@ public Object get(Serializable id, Serializable keyspace) {
/*
* (non-Javadoc)
- * @see org.springframework.data.keyvalue.core.KeyValueAdapter#delete(java.io.Serializable, java.io.Serializable)
+ * @see org.springframework.data.keyvalue.core.KeyValueAdapter#delete(java.lang.Object, java.lang.String)
*/
@Override
- public Object delete(Serializable id, Serializable keyspace) {
+ public Object delete(Object id, String keyspace) {
Assert.notNull(id, "Cannot delete item with null id.");
return getKeySpaceMap(keyspace).remove(id);
@@ -137,28 +136,28 @@ public Object delete(Serializable id, Serializable keyspace) {
/*
* (non-Javadoc)
- * @see org.springframework.data.keyvalue.core.KeyValueAdapter#getAllOf(java.io.Serializable)
+ * @see org.springframework.data.keyvalue.core.KeyValueAdapter#getAllOf(java.lang.String)
*/
@Override
- public Collection> getAllOf(Serializable keyspace) {
+ public Collection> getAllOf(String keyspace) {
return getKeySpaceMap(keyspace).values();
}
/*
* (non-Javadoc)
- * @see org.springframework.data.keyvalue.core.KeyValueAdapter#entries(java.io.Serializable)
+ * @see org.springframework.data.keyvalue.core.KeyValueAdapter#entries(java.lang.String)
*/
@Override
- public CloseableIterator> entries(Serializable keyspace) {
+ public CloseableIterator> entries(String keyspace) {
return new ForwardingCloseableIterator<>(getKeySpaceMap(keyspace).entrySet().iterator());
}
/*
* (non-Javadoc)
- * @see org.springframework.data.keyvalue.core.KeyValueAdapter#deleteAllOf(java.io.Serializable)
+ * @see org.springframework.data.keyvalue.core.KeyValueAdapter#deleteAllOf(java.lang.String)
*/
@Override
- public void deleteAllOf(Serializable keyspace) {
+ public void deleteAllOf(String keyspace) {
getKeySpaceMap(keyspace).clear();
}
@@ -186,11 +185,11 @@ public void destroy() throws Exception {
* @param keyspace must not be {@literal null}.
* @return
*/
- protected Map getKeySpaceMap(Serializable keyspace) {
+ protected Map