Skip to content

Commit

Permalink
regenerate options converters
Browse files Browse the repository at this point in the history
  • Loading branch information
craig-day committed Sep 21, 2023
1 parent fb8615b commit 059ef61
Show file tree
Hide file tree
Showing 7 changed files with 177 additions and 109 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,16 @@ public class CachingRedisOptionsConverter {
public static void fromJson(Iterable<java.util.Map.Entry<String, Object>> json, CachingRedisOptions obj) {
for (java.util.Map.Entry<String, Object> member : json) {
switch (member.getKey()) {
case "enabled":
if (member.getValue() instanceof Boolean) {
obj.setEnabled((Boolean)member.getValue());
}
break;
case "maxCacheSize":
if (member.getValue() instanceof Number) {
obj.setMaxCacheSize(((Number)member.getValue()).intValue());
}
break;
case "maxAge":
if (member.getValue() instanceof Number) {
obj.setMaxAge(((Number)member.getValue()).longValue());
Expand All @@ -30,21 +40,11 @@ public static void fromJson(Iterable<java.util.Map.Entry<String, Object>> json,
obj.setMaxAgeUnit(java.util.concurrent.TimeUnit.valueOf((String)member.getValue()));
}
break;
case "maxCacheSize":
if (member.getValue() instanceof Number) {
obj.setMaxCacheSize(((Number)member.getValue()).intValue());
}
break;
case "mode":
if (member.getValue() instanceof String) {
obj.setMode(io.vertx.redis.client.ClientSideCacheMode.valueOf((String)member.getValue()));
}
break;
case "prefix":
if (member.getValue() instanceof String) {
obj.setPrefix((String)member.getValue());
}
break;
case "prefixes":
if (member.getValue() instanceof JsonArray) {
java.util.ArrayList<java.lang.String> list = new java.util.ArrayList<>();
Expand All @@ -55,6 +55,11 @@ public static void fromJson(Iterable<java.util.Map.Entry<String, Object>> json,
obj.setPrefixes(list);
}
break;
case "prefix":
if (member.getValue() instanceof String) {
obj.setPrefix((String)member.getValue());
}
break;
case "prefixs":
if (member.getValue() instanceof JsonArray) {
((Iterable<Object>)member.getValue()).forEach( item -> {
Expand All @@ -72,11 +77,12 @@ public static void toJson(CachingRedisOptions obj, JsonObject json) {
}

public static void toJson(CachingRedisOptions obj, java.util.Map<String, Object> json) {
json.put("enabled", obj.getEnabled());
json.put("maxCacheSize", obj.getMaxCacheSize());
json.put("maxAge", obj.getMaxAge());
if (obj.getMaxAgeUnit() != null) {
json.put("maxAgeUnit", obj.getMaxAgeUnit().name());
}
json.put("maxCacheSize", obj.getMaxCacheSize());
if (obj.getMode() != null) {
json.put("mode", obj.getMode().name());
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,11 @@ public class PoolOptionsConverter {
public static void fromJson(Iterable<java.util.Map.Entry<String, Object>> json, PoolOptions obj) {
for (java.util.Map.Entry<String, Object> member : json) {
switch (member.getKey()) {
case "name":
if (member.getValue() instanceof String) {
obj.setName((String)member.getValue());
}
break;
case "cleanerInterval":
if (member.getValue() instanceof Number) {
obj.setCleanerInterval(((Number)member.getValue()).intValue());
Expand All @@ -35,11 +40,6 @@ public static void fromJson(Iterable<java.util.Map.Entry<String, Object>> json,
obj.setMaxWaiting(((Number)member.getValue()).intValue());
}
break;
case "name":
if (member.getValue() instanceof String) {
obj.setName((String)member.getValue());
}
break;
case "recycleTimeout":
if (member.getValue() instanceof Number) {
obj.setRecycleTimeout(((Number)member.getValue()).intValue());
Expand All @@ -54,12 +54,12 @@ public static void toJson(PoolOptions obj, JsonObject json) {
}

public static void toJson(PoolOptions obj, java.util.Map<String, Object> json) {
json.put("cleanerInterval", obj.getCleanerInterval());
json.put("maxSize", obj.getMaxSize());
json.put("maxWaiting", obj.getMaxWaiting());
if (obj.getName() != null) {
json.put("name", obj.getName());
}
json.put("cleanerInterval", obj.getCleanerInterval());
json.put("maxSize", obj.getMaxSize());
json.put("maxWaiting", obj.getMaxWaiting());
json.put("recycleTimeout", obj.getRecycleTimeout());
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -20,51 +20,51 @@ public class RedisConnectOptionsConverter {
public static void fromJson(Iterable<java.util.Map.Entry<String, Object>> json, RedisConnectOptions obj) {
for (java.util.Map.Entry<String, Object> member : json) {
switch (member.getKey()) {
case "connectionString":
case "maxNestedArrays":
if (member.getValue() instanceof Number) {
obj.setMaxNestedArrays(((Number)member.getValue()).intValue());
}
break;
case "protocolNegotiation":
if (member.getValue() instanceof Boolean) {
obj.setProtocolNegotiation((Boolean)member.getValue());
}
break;
case "password":
if (member.getValue() instanceof String) {
obj.setConnectionString((String)member.getValue());
obj.setPassword((String)member.getValue());
}
break;
case "connectionStrings":
case "endpoints":
if (member.getValue() instanceof JsonArray) {
java.util.ArrayList<java.lang.String> list = new java.util.ArrayList<>();
((Iterable<Object>)member.getValue()).forEach( item -> {
if (item instanceof String)
obj.addConnectionString((String)item);
list.add((String)item);
});
obj.setEndpoints(list);
}
break;
case "endpoint":
break;
case "endpoints":
case "connectionStrings":
if (member.getValue() instanceof JsonArray) {
java.util.ArrayList<java.lang.String> list = new java.util.ArrayList<>();
((Iterable<Object>)member.getValue()).forEach( item -> {
if (item instanceof String)
list.add((String)item);
obj.addConnectionString((String)item);
});
obj.setEndpoints(list);
}
break;
case "maxNestedArrays":
if (member.getValue() instanceof Number) {
obj.setMaxNestedArrays(((Number)member.getValue()).intValue());
case "connectionString":
if (member.getValue() instanceof String) {
obj.setConnectionString((String)member.getValue());
}
break;
case "maxWaitingHandlers":
if (member.getValue() instanceof Number) {
obj.setMaxWaitingHandlers(((Number)member.getValue()).intValue());
}
break;
case "password":
if (member.getValue() instanceof String) {
obj.setPassword((String)member.getValue());
}
break;
case "protocolNegotiation":
if (member.getValue() instanceof Boolean) {
obj.setProtocolNegotiation((Boolean)member.getValue());
}
break;
}
}
}
Expand All @@ -74,19 +74,19 @@ public static void toJson(RedisConnectOptions obj, JsonObject json) {
}

public static void toJson(RedisConnectOptions obj, java.util.Map<String, Object> json) {
if (obj.getEndpoint() != null) {
json.put("endpoint", obj.getEndpoint());
json.put("maxNestedArrays", obj.getMaxNestedArrays());
json.put("protocolNegotiation", obj.isProtocolNegotiation());
if (obj.getPassword() != null) {
json.put("password", obj.getPassword());
}
if (obj.getEndpoints() != null) {
JsonArray array = new JsonArray();
obj.getEndpoints().forEach(item -> array.add(item));
json.put("endpoints", array);
}
json.put("maxNestedArrays", obj.getMaxNestedArrays());
json.put("maxWaitingHandlers", obj.getMaxWaitingHandlers());
if (obj.getPassword() != null) {
json.put("password", obj.getPassword());
if (obj.getEndpoint() != null) {
json.put("endpoint", obj.getEndpoint());
}
json.put("protocolNegotiation", obj.isProtocolNegotiation());
json.put("maxWaitingHandlers", obj.getMaxWaitingHandlers());
}
}
Loading

0 comments on commit 059ef61

Please sign in to comment.