@@ -47,6 +47,7 @@ Command<K, V, List<Long>> jsonArrappend(K key, JsonPath jsonPath, JsonValue... j
47
47
CommandArgs <K , V > args = new CommandArgs <>(codec ).addKey (key );
48
48
49
49
if (jsonPath != null && !jsonPath .isRootPath ()) {
50
+ // OPTIONAL as per API
50
51
args .add (jsonPath .toString ());
51
52
}
52
53
@@ -62,10 +63,7 @@ Command<K, V, List<Long>> jsonArrindex(K key, JsonPath jsonPath, JsonValue value
62
63
63
64
CommandArgs <K , V > args = new CommandArgs <>(codec ).addKey (key );
64
65
65
- if (jsonPath != null && !jsonPath .isRootPath ()) {
66
- args .add (jsonPath .toString ());
67
- }
68
-
66
+ args .add (jsonPath .toString ());
69
67
args .add (value .asByteBuffer ().array ());
70
68
71
69
if (range != null ) {
@@ -81,10 +79,7 @@ Command<K, V, List<Long>> jsonArrinsert(K key, JsonPath jsonPath, int index, Jso
81
79
82
80
CommandArgs <K , V > args = new CommandArgs <>(codec ).addKey (key );
83
81
84
- if (jsonPath != null && !jsonPath .isRootPath ()) {
85
- args .add (jsonPath .toString ());
86
- }
87
-
82
+ args .add (jsonPath .toString ());
88
83
args .add (index );
89
84
90
85
for (JsonValue value : values ) {
@@ -100,6 +95,7 @@ Command<K, V, List<Long>> jsonArrlen(K key, JsonPath jsonPath) {
100
95
CommandArgs <K , V > args = new CommandArgs <>(codec ).addKey (key );
101
96
102
97
if (jsonPath != null && !jsonPath .isRootPath ()) {
98
+ // OPTIONAL as per API
103
99
args .add (jsonPath .toString ());
104
100
}
105
101
return createCommand (JSON_ARRLEN , (CommandOutput ) new ArrayOutput <>(codec ), args );
@@ -110,10 +106,12 @@ Command<K, V, List<JsonValue>> jsonArrpop(K key, JsonPath jsonPath, int index) {
110
106
111
107
CommandArgs <K , V > args = new CommandArgs <>(codec ).addKey (key );
112
108
113
- if (jsonPath != null ) {
109
+ if (jsonPath != null && !jsonPath .isRootPath ()) {
110
+ // OPTIONAL as per API
114
111
args .add (jsonPath .toString ());
115
112
116
113
if (index != -1 ) {
114
+ // OPTIONAL as per API
117
115
args .add (index );
118
116
}
119
117
}
@@ -126,10 +124,7 @@ Command<K, V, List<Long>> jsonArrtrim(K key, JsonPath jsonPath, JsonRangeArgs ra
126
124
notNullKey (key );
127
125
128
126
CommandArgs <K , V > args = new CommandArgs <>(codec ).addKey (key );
129
-
130
- if (jsonPath != null && !jsonPath .isRootPath ()) {
131
- args .add (jsonPath .toString ());
132
- }
127
+ args .add (jsonPath .toString ());
133
128
134
129
if (range != null ) {
135
130
range .build (args );
@@ -144,6 +139,7 @@ Command<K, V, Long> jsonClear(K key, JsonPath jsonPath) {
144
139
CommandArgs <K , V > args = new CommandArgs <>(codec ).addKey (key );
145
140
146
141
if (jsonPath != null && !jsonPath .isRootPath ()) {
142
+ // OPTIONAL as per API
147
143
args .add (jsonPath .toString ());
148
144
}
149
145
@@ -156,10 +152,12 @@ Command<K, V, List<JsonValue>> jsonGet(K key, JsonGetArgs options, JsonPath... j
156
152
CommandArgs <K , V > args = new CommandArgs <>(codec ).addKey (key );
157
153
158
154
if (options != null ) {
155
+ // OPTIONAL as per API
159
156
options .build (args );
160
157
}
161
158
162
159
if (jsonPaths != null ) {
160
+ // OPTIONAL as per API
163
161
for (JsonPath jsonPath : jsonPaths ) {
164
162
if (jsonPath != null ) {
165
163
args .add (jsonPath .toString ());
@@ -175,11 +173,7 @@ Command<K, V, String> jsonMerge(K key, JsonPath jsonPath, JsonValue value) {
175
173
notNullKey (key );
176
174
177
175
CommandArgs <K , V > args = new CommandArgs <>(codec ).addKey (key );
178
-
179
- if (jsonPath != null && !jsonPath .isRootPath ()) {
180
- args .add (jsonPath .toString ());
181
- }
182
-
176
+ args .add (jsonPath .toString ());
183
177
args .add (value .asByteBuffer ().array ());
184
178
185
179
return createCommand (JSON_MERGE , new StatusOutput <>(codec ), args );
@@ -189,10 +183,7 @@ Command<K, V, List<JsonValue>> jsonMGet(JsonPath jsonPath, K... keys) {
189
183
notEmpty (keys );
190
184
191
185
CommandArgs <K , V > args = new CommandArgs <>(codec ).addKeys (keys );
192
-
193
- if (jsonPath != null ) {
194
- args .add (jsonPath .toString ());
195
- }
186
+ args .add (jsonPath .toString ());
196
187
197
188
return createCommand (JSON_MGET , new JsonValueListOutput <>(codec , parser .get ()), args );
198
189
}
@@ -214,11 +205,7 @@ Command<K, V, List<Number>> jsonNumincrby(K key, JsonPath jsonPath, Number numbe
214
205
notNullKey (key );
215
206
216
207
CommandArgs <K , V > args = new CommandArgs <>(codec ).addKey (key );
217
-
218
- if (jsonPath != null && !jsonPath .isRootPath ()) {
219
- args .add (jsonPath .toString ());
220
- }
221
-
208
+ args .add (jsonPath .toString ());
222
209
args .add (number .toString ());
223
210
224
211
return createCommand (JSON_NUMINCRBY , new NumberListOutput <>(codec ), args );
@@ -230,6 +217,7 @@ Command<K, V, List<V>> jsonObjkeys(K key, JsonPath jsonPath) {
230
217
CommandArgs <K , V > args = new CommandArgs <>(codec ).addKey (key );
231
218
232
219
if (jsonPath != null && !jsonPath .isRootPath ()) {
220
+ // OPTIONAL as per API
233
221
args .add (jsonPath .toString ());
234
222
}
235
223
@@ -243,6 +231,7 @@ Command<K, V, List<Long>> jsonObjlen(K key, JsonPath jsonPath) {
243
231
CommandArgs <K , V > args = new CommandArgs <>(codec ).addKey (key );
244
232
245
233
if (jsonPath != null && !jsonPath .isRootPath ()) {
234
+ // OPTIONAL as per API
246
235
args .add (jsonPath .toString ());
247
236
}
248
237
@@ -259,6 +248,7 @@ Command<K, V, String> jsonSet(K key, JsonPath jsonPath, JsonValue value, JsonSet
259
248
args .add (value .asByteBuffer ().array ());
260
249
261
250
if (options != null ) {
251
+ // OPTIONAL as per API
262
252
options .build (args );
263
253
}
264
254
@@ -271,6 +261,7 @@ Command<K, V, List<Long>> jsonStrappend(K key, JsonPath jsonPath, JsonValue valu
271
261
CommandArgs <K , V > args = new CommandArgs <>(codec ).addKey (key );
272
262
273
263
if (jsonPath != null && !jsonPath .isRootPath ()) {
264
+ // OPTIONAL as per API
274
265
args .add (jsonPath .toString ());
275
266
}
276
267
@@ -286,6 +277,7 @@ Command<K, V, List<Long>> jsonStrlen(K key, JsonPath jsonPath) {
286
277
CommandArgs <K , V > args = new CommandArgs <>(codec ).addKey (key );
287
278
288
279
if (jsonPath != null && !jsonPath .isRootPath ()) {
280
+ // OPTIONAL as per API
289
281
args .add (jsonPath .toString ());
290
282
}
291
283
@@ -296,10 +288,7 @@ Command<K, V, List<Long>> jsonToggle(K key, JsonPath jsonPath) {
296
288
notNullKey (key );
297
289
298
290
CommandArgs <K , V > args = new CommandArgs <>(codec ).addKey (key );
299
-
300
- if (jsonPath != null && !jsonPath .isRootPath ()) {
301
- args .add (jsonPath .toString ());
302
- }
291
+ args .add (jsonPath .toString ());
303
292
304
293
return createCommand (JSON_TOGGLE , (CommandOutput ) new ArrayOutput <>(codec ), args );
305
294
}
@@ -310,6 +299,7 @@ Command<K, V, Long> jsonDel(K key, JsonPath jsonPath) {
310
299
CommandArgs <K , V > args = new CommandArgs <>(codec ).addKey (key );
311
300
312
301
if (jsonPath != null && !jsonPath .isRootPath ()) {
302
+ // OPTIONAL as per API
313
303
args .add (jsonPath .toString ());
314
304
}
315
305
return createCommand (JSON_DEL , new IntegerOutput <>(codec ), args );
@@ -321,6 +311,7 @@ Command<K, V, List<JsonType>> jsonType(K key, JsonPath jsonPath) {
321
311
CommandArgs <K , V > args = new CommandArgs <>(codec ).addKey (key );
322
312
323
313
if (jsonPath != null && !jsonPath .isRootPath ()) {
314
+ // OPTIONAL as per API
324
315
args .add (jsonPath .toString ());
325
316
}
326
317
0 commit comments