Polishing.

Add missing Nullable annotations. Reorder methods.

See: #2996
Original pull request: #2997
This commit is contained in:
Mark Paluch
2024-09-17 14:20:47 +02:00
parent 078f6baaa0
commit 7dd8b8ed5d
3 changed files with 14 additions and 13 deletions

View File

@@ -249,6 +249,7 @@ public interface BoundListOperations<K, V> extends BoundKeyOperations<K> {
* @since 2.4
* @see <a href="https://redis.io/commands/lpos">Redis Documentation: LPOS</a>
*/
@Nullable
Long indexOf(V value);
/**
@@ -260,6 +261,7 @@ public interface BoundListOperations<K, V> extends BoundKeyOperations<K> {
* @since 2.4
* @see <a href="https://redis.io/commands/lpos">Redis Documentation: LPOS</a>
*/
@Nullable
Long lastIndexOf(V value);
/**

View File

@@ -131,13 +131,6 @@ public abstract class AbstractRedisCollection<E> extends AbstractCollection<E> i
key = newKey;
}
protected void checkResult(@Nullable Object obj) {
if (obj == null) {
throw new IllegalStateException("Cannot read collection with Redis connection in pipeline/multi-exec mode");
}
}
@Override
public boolean equals(@Nullable Object o) {
@@ -168,4 +161,11 @@ public abstract class AbstractRedisCollection<E> extends AbstractCollection<E> i
public String toString() {
return "%s for key: %s".formatted(getClass().getSimpleName(), getKey());
}
protected void checkResult(@Nullable Object obj) {
if (obj == null) {
throw new IllegalStateException("Cannot read collection with Redis connection in pipeline/multi-exec mode");
}
}
}

View File

@@ -187,7 +187,6 @@ public class DefaultRedisMap<K, V> implements RedisMap<K, V> {
@Override
public String toString() {
return "RedisStore for key:" + getKey();
}
@@ -317,17 +316,17 @@ public class DefaultRedisMap<K, V> implements RedisMap<K, V> {
return hashOps.getType();
}
@Override
public Cursor<java.util.Map.Entry<K, V>> scan() {
return scan(ScanOptions.NONE);
}
private void checkResult(@Nullable Object obj) {
if (obj == null) {
throw new IllegalStateException("Cannot read collection with Redis connection in pipeline/multi-exec mode");
}
}
@Override
public Cursor<java.util.Map.Entry<K, V>> scan() {
return scan(ScanOptions.NONE);
}
/**
* @since 1.4
* @param options