DATAREDIS-1122 - Polishing.

Consistently use Maxlen lettercasing. Add since tags. Reformat code.

Original pull request: #523.
This commit is contained in:
Mark Paluch
2020-04-20 10:21:11 +02:00
parent 43ef4700c1
commit 649b579fe8
4 changed files with 10 additions and 6 deletions

View File

@@ -262,6 +262,7 @@ public interface ReactiveStreamCommands {
* Limit the size of the stream to the given maximum number of elements.
*
* @return can be {@literal null}.
* @since 2.3
*/
@Nullable
public Long getMaxlen() {
@@ -270,8 +271,9 @@ public interface ReactiveStreamCommands {
/**
* @return {@literal true} if {@literal MAXLEN} is set.
* @since 2.3
*/
public boolean hasMaxLen() {
public boolean hasMaxlen() {
return maxlen != null && maxlen > 0;
}
}

View File

@@ -113,7 +113,9 @@ public interface RedisStreamCommands {
*/
class XAddOptions {
private @Nullable Long maxlen;
private static final XAddOptions NONE = new XAddOptions(null);
private final @Nullable Long maxlen;
private XAddOptions(@Nullable Long maxlen) {
this.maxlen = maxlen;
@@ -123,7 +125,7 @@ public interface RedisStreamCommands {
* @return
*/
public static XAddOptions none() {
return new XAddOptions(null);
return NONE;
}
/**
@@ -148,7 +150,7 @@ public interface RedisStreamCommands {
/**
* @return {@literal true} if {@literal MAXLEN} is set.
*/
public boolean hasMaxLen() {
public boolean hasMaxlen() {
return maxlen != null && maxlen > 0;
}

View File

@@ -100,7 +100,7 @@ class LettuceReactiveStreamCommands implements ReactiveStreamCommands {
if (!command.getRecord().getId().shouldBeAutoGenerated()) {
args.id(command.getRecord().getId().getValue());
}
if(command.hasMaxLen()) {
if (command.hasMaxlen()) {
args.maxlen(command.getMaxlen());
}

View File

@@ -91,7 +91,7 @@ class LettuceStreamCommands implements RedisStreamCommands {
XAddArgs args = new XAddArgs();
args.id(record.getId().getValue());
if(options.hasMaxLen()) {
if (options.hasMaxlen()) {
args.maxlen(options.getMaxlen());
}