Skip to content

Commit 649b579

Browse files
committed
DATAREDIS-1122 - Polishing.
Consistently use Maxlen lettercasing. Add since tags. Reformat code. Original pull request: spring-projects#523.
1 parent 43ef470 commit 649b579

File tree

4 files changed

+10
-6
lines changed

4 files changed

+10
-6
lines changed

src/main/java/org/springframework/data/redis/connection/ReactiveStreamCommands.java

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -262,6 +262,7 @@ public ByteBufferRecord getRecord() {
262262
* Limit the size of the stream to the given maximum number of elements.
263263
*
264264
* @return can be {@literal null}.
265+
* @since 2.3
265266
*/
266267
@Nullable
267268
public Long getMaxlen() {
@@ -270,8 +271,9 @@ public Long getMaxlen() {
270271

271272
/**
272273
* @return {@literal true} if {@literal MAXLEN} is set.
274+
* @since 2.3
273275
*/
274-
public boolean hasMaxLen() {
276+
public boolean hasMaxlen() {
275277
return maxlen != null && maxlen > 0;
276278
}
277279
}

src/main/java/org/springframework/data/redis/connection/RedisStreamCommands.java

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -113,7 +113,9 @@ default RecordId xAdd(MapRecord<byte[], byte[], byte[]> record) {
113113
*/
114114
class XAddOptions {
115115

116-
private @Nullable Long maxlen;
116+
private static final XAddOptions NONE = new XAddOptions(null);
117+
118+
private final @Nullable Long maxlen;
117119

118120
private XAddOptions(@Nullable Long maxlen) {
119121
this.maxlen = maxlen;
@@ -123,7 +125,7 @@ private XAddOptions(@Nullable Long maxlen) {
123125
* @return
124126
*/
125127
public static XAddOptions none() {
126-
return new XAddOptions(null);
128+
return NONE;
127129
}
128130

129131
/**
@@ -148,7 +150,7 @@ public Long getMaxlen() {
148150
/**
149151
* @return {@literal true} if {@literal MAXLEN} is set.
150152
*/
151-
public boolean hasMaxLen() {
153+
public boolean hasMaxlen() {
152154
return maxlen != null && maxlen > 0;
153155
}
154156

src/main/java/org/springframework/data/redis/connection/lettuce/LettuceReactiveStreamCommands.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -100,7 +100,7 @@ public Flux<CommandResponse<AddStreamRecord, RecordId>> xAdd(Publisher<AddStream
100100
if (!command.getRecord().getId().shouldBeAutoGenerated()) {
101101
args.id(command.getRecord().getId().getValue());
102102
}
103-
if(command.hasMaxLen()) {
103+
if (command.hasMaxlen()) {
104104
args.maxlen(command.getMaxlen());
105105
}
106106

src/main/java/org/springframework/data/redis/connection/lettuce/LettuceStreamCommands.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -91,7 +91,7 @@ public RecordId xAdd(MapRecord<byte[], byte[], byte[]> record, XAddOptions optio
9191

9292
XAddArgs args = new XAddArgs();
9393
args.id(record.getId().getValue());
94-
if(options.hasMaxLen()) {
94+
if (options.hasMaxlen()) {
9595
args.maxlen(options.getMaxlen());
9696
}
9797

0 commit comments

Comments
 (0)