Skip to content

Commit

Permalink
Deprecate RedisJSON v1 support
Browse files Browse the repository at this point in the history
  • Loading branch information
sazzad16 committed Aug 17, 2023
1 parent 3d874e1 commit 2762911
Show file tree
Hide file tree
Showing 6 changed files with 133 additions and 3 deletions.
10 changes: 10 additions & 0 deletions src/main/java/redis/clients/jedis/CommandObjects.java
Original file line number Diff line number Diff line change
Expand Up @@ -3464,6 +3464,7 @@ public final CommandObject<Object> jsonGet(String key) {
protocol != RedisProtocol.RESP3 ? JSON_GENERIC_OBJECT : JsonBuilderFactory.JSON_OBJECT);
}

@Deprecated
public final <T> CommandObject<T> jsonGet(String key, Class<T> clazz) {
return new CommandObject<>(commandArguments(JsonCommand.GET).key(key), new JsonObjectBuilder<>(clazz));
}
Expand Down Expand Up @@ -3524,6 +3525,7 @@ public final CommandObject<String> jsonToggle(String key, Path path) {
return new CommandObject<>(commandArguments(JsonCommand.TOGGLE).key(key).add(path), BuilderFactory.STRING);
}

@Deprecated
public final CommandObject<Class<?>> jsonType(String key) {
return new CommandObject<>(commandArguments(JsonCommand.TYPE).key(key), JsonBuilderFactory.JSON_TYPE);
}
Expand All @@ -3537,6 +3539,7 @@ public final CommandObject<Class<?>> jsonType(String key, Path path) {
return new CommandObject<>(commandArguments(JsonCommand.TYPE).key(key).add(path), JsonBuilderFactory.JSON_TYPE);
}

@Deprecated
public final CommandObject<Long> jsonStrAppend(String key, Object string) {
return new CommandObject<>(commandArguments(JsonCommand.STRAPPEND).key(key).add(
getJsonObjectMapper().toJson(string)), BuilderFactory.LONG);
Expand All @@ -3552,6 +3555,7 @@ public final CommandObject<Long> jsonStrAppend(String key, Path path, Object str
getJsonObjectMapper().toJson(string)), BuilderFactory.LONG);
}

@Deprecated
public final CommandObject<Long> jsonStrLen(String key) {
return new CommandObject<>(commandArguments(JsonCommand.STRLEN).key(key), BuilderFactory.LONG);
}
Expand Down Expand Up @@ -3637,10 +3641,12 @@ public final CommandObject<Long> jsonArrInsert(String key, Path path, int index,
return new CommandObject<>(args, BuilderFactory.LONG);
}

@Deprecated
public final CommandObject<Object> jsonArrPop(String key) {
return new CommandObject<>(commandArguments(JsonCommand.ARRPOP).key(key), new JsonObjectBuilder<>(Object.class));
}

@Deprecated
public final <T> CommandObject<T> jsonArrPop(String key, Class<T> clazz) {
return new CommandObject<>(commandArguments(JsonCommand.ARRPOP).key(key), new JsonObjectBuilder<>(clazz));
}
Expand Down Expand Up @@ -3669,6 +3675,7 @@ public final <T> CommandObject<T> jsonArrPop(String key, Class<T> clazz, Path pa
return new CommandObject<>(commandArguments(JsonCommand.ARRPOP).key(key).add(path).add(index), new JsonObjectBuilder<>(clazz));
}

@Deprecated
public final CommandObject<Long> jsonArrLen(String key) {
return new CommandObject<>(commandArguments(JsonCommand.ARRLEN).key(key), BuilderFactory.LONG);
}
Expand All @@ -3689,6 +3696,7 @@ public final CommandObject<Long> jsonArrTrim(String key, Path path, int start, i
return new CommandObject<>(commandArguments(JsonCommand.ARRTRIM).key(key).add(path).add(start).add(stop), BuilderFactory.LONG);
}

@Deprecated
public final CommandObject<Long> jsonObjLen(String key) {
return new CommandObject<>(commandArguments(JsonCommand.OBJLEN).key(key), BuilderFactory.LONG);
}
Expand All @@ -3701,6 +3709,7 @@ public final CommandObject<List<Long>> jsonObjLen(String key, Path2 path) {
return new CommandObject<>(commandArguments(JsonCommand.OBJLEN).key(key).add(path), BuilderFactory.LONG_LIST);
}

@Deprecated
public final CommandObject<List<String>> jsonObjKeys(String key) {
return new CommandObject<>(commandArguments(JsonCommand.OBJKEYS).key(key), BuilderFactory.STRING_LIST);
}
Expand All @@ -3713,6 +3722,7 @@ public final CommandObject<List<List<String>>> jsonObjKeys(String key, Path2 pat
return new CommandObject<>(commandArguments(JsonCommand.OBJKEYS).key(key).add(path), BuilderFactory.STRING_LIST_LIST);
}

@Deprecated
public final CommandObject<Long> jsonDebugMemory(String key) {
return new CommandObject<>(commandArguments(JsonCommand.DEBUG).add("MEMORY").key(key), BuilderFactory.LONG);
}
Expand Down
37 changes: 37 additions & 0 deletions src/main/java/redis/clients/jedis/UnifiedJedis.java
Original file line number Diff line number Diff line change
Expand Up @@ -3896,11 +3896,13 @@ public String jsonSetWithEscape(String key, Path2 path, Object object) {
}

@Override
@Deprecated
public String jsonSet(String key, Path path, Object pojo) {
return executeCommand(commandObjects.jsonSet(key, path, pojo));
}

@Override
@Deprecated
public String jsonSetWithPlainString(String key, Path path, String string) {
return executeCommand(commandObjects.jsonSetWithPlainString(key, path, string));
}
Expand All @@ -3916,6 +3918,7 @@ public String jsonSetWithEscape(String key, Path2 path, Object pojo, JsonSetPara
}

@Override
@Deprecated
public String jsonSet(String key, Path path, Object pojo, JsonSetParams params) {
return executeCommand(commandObjects.jsonSet(key, path, pojo, params));
}
Expand All @@ -3926,6 +3929,7 @@ public String jsonMerge(String key, Path2 path, Object object) {
}

@Override
@Deprecated
public String jsonMerge(String key, Path path, Object pojo) {
return executeCommand(commandObjects.jsonMerge(key, path, pojo));
}
Expand All @@ -3936,6 +3940,7 @@ public Object jsonGet(String key) {
}

@Override
@Deprecated
public <T> T jsonGet(String key, Class<T> clazz) {
return executeCommand(commandObjects.jsonGet(key, clazz));
}
Expand All @@ -3946,16 +3951,19 @@ public Object jsonGet(String key, Path2... paths) {
}

@Override
@Deprecated
public Object jsonGet(String key, Path... paths) {
return executeCommand(commandObjects.jsonGet(key, paths));
}

@Override
@Deprecated
public String jsonGetAsPlainString(String key, Path path) {
return executeCommand(commandObjects.jsonGetAsPlainString(key, path));
}

@Override
@Deprecated
public <T> T jsonGet(String key, Class<T> clazz, Path... paths) {
return executeCommand(commandObjects.jsonGet(key, clazz, paths));
}
Expand All @@ -3966,6 +3974,7 @@ public List<JSONArray> jsonMGet(Path2 path, String... keys) {
}

@Override
@Deprecated
public <T> List<T> jsonMGet(Path path, Class<T> clazz, String... keys) {
return executeCommand(commandObjects.jsonMGet(path, clazz, keys));
}
Expand All @@ -3981,6 +3990,7 @@ public long jsonDel(String key, Path2 path) {
}

@Override
@Deprecated
public long jsonDel(String key, Path path) {
return executeCommand(commandObjects.jsonDel(key, path));
}
Expand All @@ -3996,6 +4006,7 @@ public long jsonClear(String key, Path2 path) {
}

@Override
@Deprecated
public long jsonClear(String key, Path path) {
return executeCommand(commandObjects.jsonClear(key, path));
}
Expand All @@ -4006,11 +4017,13 @@ public List<Boolean> jsonToggle(String key, Path2 path) {
}

@Override
@Deprecated
public String jsonToggle(String key, Path path) {
return executeCommand(commandObjects.jsonToggle(key, path));
}

@Override
@Deprecated
public Class<?> jsonType(String key) {
return executeCommand(commandObjects.jsonType(key));
}
Expand All @@ -4021,11 +4034,13 @@ public List<Class<?>> jsonType(String key, Path2 path) {
}

@Override
@Deprecated
public Class<?> jsonType(String key, Path path) {
return executeCommand(commandObjects.jsonType(key, path));
}

@Override
@Deprecated
public long jsonStrAppend(String key, Object string) {
return executeCommand(commandObjects.jsonStrAppend(key, string));
}
Expand All @@ -4036,11 +4051,13 @@ public List<Long> jsonStrAppend(String key, Path2 path, Object string) {
}

@Override
@Deprecated
public long jsonStrAppend(String key, Path path, Object string) {
return executeCommand(commandObjects.jsonStrAppend(key, path, string));
}

@Override
@Deprecated
public Long jsonStrLen(String key) {
return executeCommand(commandObjects.jsonStrLen(key));
}
Expand All @@ -4051,6 +4068,7 @@ public List<Long> jsonStrLen(String key, Path2 path) {
}

@Override
@Deprecated
public Long jsonStrLen(String key, Path path) {
return executeCommand(commandObjects.jsonStrLen(key, path));
}
Expand All @@ -4061,6 +4079,7 @@ public Object jsonNumIncrBy(String key, Path2 path, double value) {
}

@Override
@Deprecated
public double jsonNumIncrBy(String key, Path path, double value) {
return executeCommand(commandObjects.jsonNumIncrBy(key, path, value));
}
Expand All @@ -4076,6 +4095,7 @@ public List<Long> jsonArrAppendWithEscape(String key, Path2 path, Object... obje
}

@Override
@Deprecated
public Long jsonArrAppend(String key, Path path, Object... pojos) {
return executeCommand(commandObjects.jsonArrAppend(key, path, pojos));
}
Expand All @@ -4091,6 +4111,7 @@ public List<Long> jsonArrIndexWithEscape(String key, Path2 path, Object scalar)
}

@Override
@Deprecated
public long jsonArrIndex(String key, Path path, Object scalar) {
return executeCommand(commandObjects.jsonArrIndex(key, path, scalar));
}
Expand All @@ -4106,16 +4127,19 @@ public List<Long> jsonArrInsertWithEscape(String key, Path2 path, int index, Obj
}

@Override
@Deprecated
public long jsonArrInsert(String key, Path path, int index, Object... pojos) {
return executeCommand(commandObjects.jsonArrInsert(key, path, index, pojos));
}

@Override
@Deprecated
public Object jsonArrPop(String key) {
return executeCommand(commandObjects.jsonArrPop(key));
}

@Override
@Deprecated
public <T> T jsonArrPop(String key, Class<T> clazz) {
return executeCommand(commandObjects.jsonArrPop(key, clazz));
}
Expand All @@ -4126,11 +4150,13 @@ public List<Object> jsonArrPop(String key, Path2 path) {
}

@Override
@Deprecated
public Object jsonArrPop(String key, Path path) {
return executeCommand(commandObjects.jsonArrPop(key, path));
}

@Override
@Deprecated
public <T> T jsonArrPop(String key, Class<T> clazz, Path path) {
return executeCommand(commandObjects.jsonArrPop(key, clazz, path));
}
Expand All @@ -4141,16 +4167,19 @@ public List<Object> jsonArrPop(String key, Path2 path, int index) {
}

@Override
@Deprecated
public Object jsonArrPop(String key, Path path, int index) {
return executeCommand(commandObjects.jsonArrPop(key, path, index));
}

@Override
@Deprecated
public <T> T jsonArrPop(String key, Class<T> clazz, Path path, int index) {
return executeCommand(commandObjects.jsonArrPop(key, clazz, path, index));
}

@Override
@Deprecated
public Long jsonArrLen(String key) {
return executeCommand(commandObjects.jsonArrLen(key));
}
Expand All @@ -4161,6 +4190,7 @@ public List<Long> jsonArrLen(String key, Path2 path) {
}

@Override
@Deprecated
public Long jsonArrLen(String key, Path path) {
return executeCommand(commandObjects.jsonArrLen(key, path));
}
Expand All @@ -4171,16 +4201,19 @@ public List<Long> jsonArrTrim(String key, Path2 path, int start, int stop) {
}

@Override
@Deprecated
public Long jsonArrTrim(String key, Path path, int start, int stop) {
return executeCommand(commandObjects.jsonArrTrim(key, path, start, stop));
}

@Override
@Deprecated
public Long jsonObjLen(String key) {
return executeCommand(commandObjects.jsonObjLen(key));
}

@Override
@Deprecated
public Long jsonObjLen(String key, Path path) {
return executeCommand(commandObjects.jsonObjLen(key, path));
}
Expand All @@ -4191,11 +4224,13 @@ public List<Long> jsonObjLen(String key, Path2 path) {
}

@Override
@Deprecated
public List<String> jsonObjKeys(String key) {
return executeCommand(commandObjects.jsonObjKeys(key));
}

@Override
@Deprecated
public List<String> jsonObjKeys(String key, Path path) {
return executeCommand(commandObjects.jsonObjKeys(key, path));
}
Expand All @@ -4206,11 +4241,13 @@ public List<List<String>> jsonObjKeys(String key, Path2 path) {
}

@Override
@Deprecated
public long jsonDebugMemory(String key) {
return executeCommand(commandObjects.jsonDebugMemory(key));
}

@Override
@Deprecated
public long jsonDebugMemory(String key, Path path) {
return executeCommand(commandObjects.jsonDebugMemory(key, path));
}
Expand Down
4 changes: 3 additions & 1 deletion src/main/java/redis/clients/jedis/json/Path.java
Original file line number Diff line number Diff line change
@@ -1,8 +1,10 @@
package redis.clients.jedis.json;

/**
* Path is a ReJSON path, representing a valid path into an object
* Path is a RedisJSON (v1) path, representing a valid path into an object.
* @deprecated RedisJSON (v1) support is deprecated.
*/
@Deprecated
public class Path {

public static final Path ROOT_PATH = new Path(".");
Expand Down
2 changes: 1 addition & 1 deletion src/main/java/redis/clients/jedis/json/Path2.java
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
package redis.clients.jedis.json;

/**
* Path is a ReJSON path, representing a valid path into an object
* Path is a RedisJSON v2 path, representing a valid path or a multi-path into an object.
*/
public class Path2 {

Expand Down
Loading

0 comments on commit 2762911

Please sign in to comment.