Skip to content

Commit cd1e1ae

Browse files
committed
Polish JSON API documentation and formatting #3369
- Remove JavaDoc comments from RedisJsonCommandBuilder String methods to match class conventions - Update @author entries to use full names (SeungSu Kim) - Fix @SInCE annotation from 6.5 to 6.9 for new String overload methods - Restore blank lines and fix spacing to maintain consistent formatting - Align documentation style with existing codebase patterns
1 parent 06109f6 commit cd1e1ae

File tree

7 files changed

+28
-75
lines changed

7 files changed

+28
-75
lines changed

src/main/java/io/lettuce/core/AbstractRedisAsyncCommands.java

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -89,7 +89,7 @@
8989
* @author dengliming
9090
* @author Andrey Shlykov
9191
* @author Ali Takavci
92-
* @author KoKimSS
92+
* @author SeugnSu Kim
9393
*/
9494
@SuppressWarnings("unchecked")
9595
public abstract class AbstractRedisAsyncCommands<K, V> implements RedisAclAsyncCommands<K, V>, RedisHashAsyncCommands<K, V>,
@@ -3846,4 +3846,5 @@ private byte[] encodeScript(String script) {
38463846
LettuceAssert.notEmpty(script, "Lua script must not be empty");
38473847
return script.getBytes(getConnection().getOptions().getScriptCharset());
38483848
}
3849+
38493850
}

src/main/java/io/lettuce/core/AbstractRedisReactiveCommands.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -98,7 +98,7 @@
9898
* @author Andrey Shlykov
9999
* @author Ali Takavci
100100
* @author Tihomir Mateev
101-
* @author KokimSS
101+
* @author SeugnSu Kim
102102
* @since 4.0
103103
*/
104104
public abstract class AbstractRedisReactiveCommands<K, V>

src/main/java/io/lettuce/core/RedisJsonCommandBuilder.java

Lines changed: 1 addition & 49 deletions
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,7 @@
3030
* Implementation of the {@link BaseRedisCommandBuilder} handling JSON commands.
3131
*
3232
* @author Tihomir Mateev
33-
* @author KoKimSS
33+
* @author SeugnSu Kim
3434
* @since 6.5
3535
*/
3636
class RedisJsonCommandBuilder<K, V> extends BaseRedisCommandBuilder<K, V> {
@@ -59,15 +59,6 @@ Command<K, V, List<Long>> jsonArrappend(K key, JsonPath jsonPath, JsonValue... j
5959
return createCommand(JSON_ARRAPPEND, (CommandOutput) new ArrayOutput<>(codec), args);
6060
}
6161

62-
/**
63-
* JSON.ARRAPPEND command with raw string values to avoid unnecessary conversions.
64-
*
65-
* @param key the key
66-
* @param jsonPath the JSON path
67-
* @param jsonValues the raw JSON string values
68-
* @return the command
69-
* @since 6.5
70-
*/
7162
Command<K, V, List<Long>> jsonArrappend(K key, JsonPath jsonPath, String... jsonValues) {
7263
notNullKey(key);
7364

@@ -101,16 +92,6 @@ Command<K, V, List<Long>> jsonArrindex(K key, JsonPath jsonPath, JsonValue value
10192
return createCommand(JSON_ARRINDEX, (CommandOutput) new ArrayOutput<>(codec), args);
10293
}
10394

104-
/**
105-
* JSON.ARRINDEX command with raw string value to avoid unnecessary conversions.
106-
*
107-
* @param key the key
108-
* @param jsonPath the JSON path
109-
* @param value the raw JSON string value
110-
* @param range the range arguments
111-
* @return the command
112-
* @since 6.5
113-
*/
11495
Command<K, V, List<Long>> jsonArrindex(K key, JsonPath jsonPath, String value, JsonRangeArgs range) {
11596
notNullKey(key);
11697

@@ -142,16 +123,6 @@ Command<K, V, List<Long>> jsonArrinsert(K key, JsonPath jsonPath, int index, Jso
142123
return createCommand(JSON_ARRINSERT, (CommandOutput) new ArrayOutput<>(codec), args);
143124
}
144125

145-
/**
146-
* JSON.ARRINSERT command with raw string values to avoid unnecessary conversions.
147-
*
148-
* @param key the key
149-
* @param jsonPath the JSON path
150-
* @param index the index
151-
* @param values the raw JSON string values
152-
* @return the command
153-
* @since 6.5
154-
*/
155126
Command<K, V, List<Long>> jsonArrinsert(K key, JsonPath jsonPath, int index, String... values) {
156127
notNullKey(key);
157128

@@ -258,15 +229,6 @@ Command<K, V, String> jsonMerge(K key, JsonPath jsonPath, JsonValue value) {
258229
return createCommand(JSON_MERGE, new StatusOutput<>(codec), args);
259230
}
260231

261-
/**
262-
* JSON.MERGE command with raw string value to avoid unnecessary conversions.
263-
*
264-
* @param key the key
265-
* @param jsonPath the JSON path
266-
* @param value the raw JSON string value
267-
* @return the command
268-
* @since 6.5
269-
*/
270232
Command<K, V, String> jsonMerge(K key, JsonPath jsonPath, String value) {
271233
notNullKey(key);
272234

@@ -353,16 +315,6 @@ Command<K, V, String> jsonSet(K key, JsonPath jsonPath, JsonValue value, JsonSet
353315
return createCommand(JSON_SET, new StatusOutput<>(codec), args);
354316
}
355317

356-
/**
357-
* JSON.SET command with raw string value to avoid unnecessary conversions.
358-
*
359-
* @param key the key
360-
* @param jsonPath the JSON path
361-
* @param value the raw JSON string value
362-
* @param options the optional {@link JsonSetArgs}
363-
* @return the command
364-
* @since 6.5
365-
*/
366318
Command<K, V, String> jsonSet(K key, JsonPath jsonPath, String value, JsonSetArgs options) {
367319
notNullKey(key);
368320

src/main/java/io/lettuce/core/api/async/RedisJsonAsyncCommands.java

Lines changed: 8 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@
2222
* @param <K> Key type.
2323
* @param <V> Value type.
2424
* @author Tihomir Mateev
25-
* @author KoKimSS
25+
* @author SeugnSu Kim
2626
* @see <a href="https://redis.io/docs/latest/develop/data-types/json/">Redis JSON</a>
2727
* @since 6.5
2828
* @generated by io.lettuce.apigenerator.CreateAsyncApi
@@ -57,7 +57,7 @@ public interface RedisJsonAsyncCommands<K, V> {
5757
* @param jsonPath the {@link JsonPath} pointing to the array inside the document.
5858
* @param jsonStrings one or more JSON strings to be appended.
5959
* @return Long the resulting size of the arrays after the new data was appended, or null if the path does not exist.
60-
* @since 6.5
60+
* @since 6.9
6161
*/
6262
RedisFuture<List<Long>> jsonArrappend(K key, JsonPath jsonPath, String... jsonStrings);
6363

@@ -94,7 +94,7 @@ public interface RedisJsonAsyncCommands<K, V> {
9494
* @param jsonString the JSON string to search for.
9595
* @param range the {@link JsonRangeArgs} to search within.
9696
* @return Long the index hosting the searched element, -1 if not found or null if the specified path is not an array.
97-
* @since 6.5
97+
* @since 6.9
9898
*/
9999
RedisFuture<List<Long>> jsonArrindex(K key, JsonPath jsonPath, String jsonString, JsonRangeArgs range);
100100

@@ -119,7 +119,7 @@ public interface RedisJsonAsyncCommands<K, V> {
119119
* @param index the index before which the new elements will be inserted.
120120
* @param jsonStrings one or more JSON strings to be inserted.
121121
* @return Long the resulting size of the arrays after the new data was inserted, or null if the path does not exist.
122-
* @since 6.5
122+
* @since 6.9
123123
*/
124124
RedisFuture<List<Long>> jsonArrinsert(K key, JsonPath jsonPath, int index, String... jsonStrings);
125125

@@ -298,7 +298,7 @@ public interface RedisJsonAsyncCommands<K, V> {
298298
* @param jsonPath the {@link JsonPath} pointing to the value to merge.
299299
* @param jsonString the JSON string to merge.
300300
* @return String "OK" if the merge was successful, error if the operation failed.
301-
* @since 6.5
301+
* @since 6.9
302302
*/
303303
RedisFuture<String> jsonMerge(K key, JsonPath jsonPath, String jsonString);
304304

@@ -422,7 +422,7 @@ public interface RedisJsonAsyncCommands<K, V> {
422422
* @param jsonString the JSON string to set.
423423
* @param options the {@link JsonSetArgs} the options for setting the value.
424424
* @return String "OK" if the set was successful, null if the {@link JsonSetArgs} conditions are not met.
425-
* @since 6.5
425+
* @since 6.9
426426
*/
427427
RedisFuture<String> jsonSet(K key, JsonPath jsonPath, String jsonString, JsonSetArgs options);
428428

@@ -454,7 +454,7 @@ public interface RedisJsonAsyncCommands<K, V> {
454454
* @param jsonPath the {@link JsonPath} pointing to the value(s) where we want to append the value.
455455
* @param jsonString the JSON string to append.
456456
* @return Long the new length of the string, or null if the matching JSON value is not a string.
457-
* @since 6.5
457+
* @since 6.9
458458
*/
459459
RedisFuture<List<Long>> jsonStrappend(K key, JsonPath jsonPath, String jsonString);
460460

@@ -507,4 +507,5 @@ public interface RedisJsonAsyncCommands<K, V> {
507507
* @since 6.5
508508
*/
509509
RedisFuture<List<JsonType>> jsonType(K key);
510+
510511
}

src/main/java/io/lettuce/core/api/reactive/RedisJsonReactiveCommands.java

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@
2323
* @param <K> Key type.
2424
* @param <V> Value type.
2525
* @author Tihomir Mateev
26-
* @author KoKimSS
26+
* @author SeugnSu Kim
2727
* @see <a href="https://redis.io/docs/latest/develop/data-types/json/">Redis JSON</a>
2828
* @since 6.5
2929
* @generated by io.lettuce.apigenerator.CreateReactiveApi
@@ -58,7 +58,7 @@ public interface RedisJsonReactiveCommands<K, V> {
5858
* @param jsonPath the {@link JsonPath} pointing to the array inside the document.
5959
* @param jsonStrings one or more JSON strings to be appended.
6060
* @return Long the resulting size of the arrays after the new data was appended, or null if the path does not exist.
61-
* @since 6.5
61+
* @since 6.9
6262
*/
6363
Flux<Long> jsonArrappend(K key, JsonPath jsonPath, String... jsonStrings);
6464

@@ -95,7 +95,7 @@ public interface RedisJsonReactiveCommands<K, V> {
9595
* @param jsonString the JSON string to search for.
9696
* @param range the {@link JsonRangeArgs} to search within.
9797
* @return Long the index hosting the searched element, -1 if not found or null if the specified path is not an array.
98-
* @since 6.5
98+
* @since 6.9
9999
*/
100100
Flux<Long> jsonArrindex(K key, JsonPath jsonPath, String jsonString, JsonRangeArgs range);
101101

@@ -120,7 +120,7 @@ public interface RedisJsonReactiveCommands<K, V> {
120120
* @param index the index before which the new elements will be inserted.
121121
* @param jsonStrings one or more JSON strings to be inserted.
122122
* @return Long the resulting size of the arrays after the new data was inserted, or null if the path does not exist.
123-
* @since 6.5
123+
* @since 6.9
124124
*/
125125
Flux<Long> jsonArrinsert(K key, JsonPath jsonPath, int index, String... jsonStrings);
126126

@@ -299,7 +299,7 @@ public interface RedisJsonReactiveCommands<K, V> {
299299
* @param jsonPath the {@link JsonPath} pointing to the value to merge.
300300
* @param jsonString the JSON string to merge.
301301
* @return String "OK" if the merge was successful, error if the operation failed.
302-
* @since 6.5
302+
* @since 6.9
303303
*/
304304
Mono<String> jsonMerge(K key, JsonPath jsonPath, String jsonString);
305305

@@ -423,7 +423,7 @@ public interface RedisJsonReactiveCommands<K, V> {
423423
* @param jsonString the JSON string to set.
424424
* @param options the {@link JsonSetArgs} the options for setting the value.
425425
* @return String "OK" if the set was successful, null if the {@link JsonSetArgs} conditions are not met.
426-
* @since 6.5
426+
* @since 6.9
427427
*/
428428
Mono<String> jsonSet(K key, JsonPath jsonPath, String jsonString, JsonSetArgs options);
429429

@@ -455,7 +455,7 @@ public interface RedisJsonReactiveCommands<K, V> {
455455
* @param jsonPath the {@link JsonPath} pointing to the value(s) where we want to append the value.
456456
* @param jsonString the JSON string to append.
457457
* @return Long the new length of the string, or null if the matching JSON value is not a string.
458-
* @since 6.5
458+
* @since 6.9
459459
*/
460460
Flux<Long> jsonStrappend(K key, JsonPath jsonPath, String jsonString);
461461

src/main/java/io/lettuce/core/api/sync/RedisJsonCommands.java

Lines changed: 8 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@
2121
* @param <K> Key type.
2222
* @param <V> Value type.
2323
* @author Tihomir Mateev
24-
* @author KoKimSS
24+
* @author SeugnSu Kim
2525
* @see <a href="https://redis.io/docs/latest/develop/data-types/json/">Redis JSON</a>
2626
* @since 6.5
2727
* @generated by io.lettuce.apigenerator.CreateSyncApi
@@ -56,7 +56,7 @@ public interface RedisJsonCommands<K, V> {
5656
* @param jsonPath the {@link JsonPath} pointing to the array inside the document.
5757
* @param jsonStrings one or more JSON strings to be appended.
5858
* @return Long the resulting size of the arrays after the new data was appended, or null if the path does not exist.
59-
* @since 6.5
59+
* @since 6.9
6060
*/
6161
List<Long> jsonArrappend(K key, JsonPath jsonPath, String... jsonStrings);
6262

@@ -93,7 +93,7 @@ public interface RedisJsonCommands<K, V> {
9393
* @param jsonString the JSON string to search for.
9494
* @param range the {@link JsonRangeArgs} to search within.
9595
* @return Long the index hosting the searched element, -1 if not found or null if the specified path is not an array.
96-
* @since 6.5
96+
* @since 6.9
9797
*/
9898
List<Long> jsonArrindex(K key, JsonPath jsonPath, String jsonString, JsonRangeArgs range);
9999

@@ -118,7 +118,7 @@ public interface RedisJsonCommands<K, V> {
118118
* @param index the index before which the new elements will be inserted.
119119
* @param jsonStrings one or more JSON strings to be inserted.
120120
* @return Long the resulting size of the arrays after the new data was inserted, or null if the path does not exist.
121-
* @since 6.5
121+
* @since 6.9
122122
*/
123123
List<Long> jsonArrinsert(K key, JsonPath jsonPath, int index, String... jsonStrings);
124124

@@ -297,7 +297,7 @@ public interface RedisJsonCommands<K, V> {
297297
* @param jsonPath the {@link JsonPath} pointing to the value to merge.
298298
* @param jsonString the JSON string to merge.
299299
* @return String "OK" if the merge was successful, error if the operation failed.
300-
* @since 6.5
300+
* @since 6.9
301301
*/
302302
String jsonMerge(K key, JsonPath jsonPath, String jsonString);
303303

@@ -421,7 +421,7 @@ public interface RedisJsonCommands<K, V> {
421421
* @param jsonString the JSON string to set.
422422
* @param options the {@link JsonSetArgs} the options for setting the value.
423423
* @return String "OK" if the set was successful, null if the {@link JsonSetArgs} conditions are not met.
424-
* @since 6.5
424+
* @since 6.9
425425
*/
426426
String jsonSet(K key, JsonPath jsonPath, String jsonString, JsonSetArgs options);
427427

@@ -453,7 +453,7 @@ public interface RedisJsonCommands<K, V> {
453453
* @param jsonPath the {@link JsonPath} pointing to the value(s) where we want to append the value.
454454
* @param jsonString the JSON string to append.
455455
* @return Long the new length of the string, or null if the matching JSON value is not a string.
456-
* @since 6.5
456+
* @since 6.9
457457
*/
458458
List<Long> jsonStrappend(K key, JsonPath jsonPath, String jsonString);
459459

@@ -506,4 +506,5 @@ public interface RedisJsonCommands<K, V> {
506506
* @since 6.5
507507
*/
508508
List<JsonType> jsonType(K key);
509+
509510
}

src/test/java/io/lettuce/core/RedisJsonCommandBuilderUnitTests.java

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,7 @@
3333
* Unit tests for {@link RedisJsonCommandBuilder}.
3434
*
3535
* @author Tihomir Mateev
36-
* @author KoKimSS
36+
* @author SeugnSu Kim
3737
*/
3838
@Tag(UNIT_TEST)
3939
class RedisJsonCommandBuilderUnitTests {
@@ -576,14 +576,12 @@ void shouldCorrectlyConstructJsonStrappendStringOverloadRootPath() {
576576

577577
@Test
578578
void shouldVerifyStringOverloadPerformanceOptimization() {
579-
// Test that String overloads bypass JsonValue creation entirely
580579
String jsonString = "{\"test\":\"performance\"}";
581580

582581
Command<String, String, String> command = builder.jsonSet(MY_KEY, JsonPath.ROOT_PATH, jsonString, JsonSetArgs.Builder.defaults());
583582
ByteBuf buf = Unpooled.directBuffer();
584583
command.encode(buf);
585584

586-
// Verify the command is constructed correctly with direct string usage
587585
String expected = "*4\r\n$8\r\nJSON.SET\r\n$15\r\nbikes:inventory\r\n$1\r\n$\r\n$22\r\n{\"test\":\"performance\"}\r\n";
588586
assertThat(buf.toString(StandardCharsets.UTF_8)).isEqualTo(expected);
589587
}

0 commit comments

Comments
 (0)