diff --git a/src/main/java/org/springframework/data/keyvalue/core/query/KeyValueQuery.java b/src/main/java/org/springframework/data/keyvalue/core/query/KeyValueQuery.java index 3665526..5b5d929 100644 --- a/src/main/java/org/springframework/data/keyvalue/core/query/KeyValueQuery.java +++ b/src/main/java/org/springframework/data/keyvalue/core/query/KeyValueQuery.java @@ -30,12 +30,14 @@ public class KeyValueQuery { private Sort sort = Sort.unsorted(); private long offset = -1; private int rows = -1; - private @Nullable T criteria; + private final @Nullable T criteria; /** * Creates new instance of {@link KeyValueQuery}. */ - public KeyValueQuery() {} + public KeyValueQuery() { + this((T) null); + } /** * Creates new instance of {@link KeyValueQuery} with given criteria. @@ -51,6 +53,7 @@ public class KeyValueQuery { * * @param criteria can be {@literal null}. * @param sort must not be {@literal null}. + * @since 2.4 */ public KeyValueQuery(@Nullable T criteria, Sort sort) { this.criteria = criteria; @@ -63,6 +66,7 @@ public class KeyValueQuery { * @param sort must not be {@literal null}. */ public KeyValueQuery(Sort sort) { + this(); setSort(sort); } diff --git a/src/main/java/org/springframework/data/map/MapKeyValueAdapter.java b/src/main/java/org/springframework/data/map/MapKeyValueAdapter.java index 0ce3a4e..88d6f0a 100644 --- a/src/main/java/org/springframework/data/map/MapKeyValueAdapter.java +++ b/src/main/java/org/springframework/data/map/MapKeyValueAdapter.java @@ -52,7 +52,8 @@ public class MapKeyValueAdapter extends AbstractKeyValueAdapter { /** * Create new {@link MapKeyValueAdapter} using the given query engine. * - * @param engine the query engine + * @param engine the query engine. + * @since 2.4 */ public MapKeyValueAdapter(QueryEngine engine) { this(ConcurrentHashMap.class, engine); @@ -72,7 +73,8 @@ public class MapKeyValueAdapter extends AbstractKeyValueAdapter { * Creates a new {@link MapKeyValueAdapter} using the given {@link Map} as backing store and query engine. * * @param mapType must not be {@literal null}. - * @param engine the query engine + * @param engine the query engine. + * @since 2.4 */ @SuppressWarnings("rawtypes") public MapKeyValueAdapter(Class mapType, QueryEngine engine) { @@ -93,7 +95,8 @@ public class MapKeyValueAdapter extends AbstractKeyValueAdapter { * Create new instance of {@link MapKeyValueAdapter} using given dataStore for persistence and query engine. * * @param store must not be {@literal null}. - * @param engine the query engine + * @param engine the query engine. + * @since 2.4 */ @SuppressWarnings({ "rawtypes", "unchecked" }) public MapKeyValueAdapter(Map> store, QueryEngine engine) { @@ -101,14 +104,16 @@ public class MapKeyValueAdapter extends AbstractKeyValueAdapter { } /** - * Creates a new {@link MapKeyValueAdapter} with the given store and type to be used when creating key spaces and query engine. + * Creates a new {@link MapKeyValueAdapter} with the given store and type to be used when creating key spaces and + * query engine. * * @param store must not be {@literal null}. * @param keySpaceMapType must not be {@literal null}. - * @param engine the query engine + * @param engine the query engine. */ @SuppressWarnings("rawtypes") private MapKeyValueAdapter(Map> store, Class keySpaceMapType, QueryEngine engine) { + super(engine); Assert.notNull(store, "Store must not be null.");