Skip to content

Commit

Permalink
Merge pull request #439 from Ladicek/gen-ignore-helper-method-in-redi…
Browse files Browse the repository at this point in the history
…s-options

@GenIgnore non-canonical getters/setters of Redis[Connect]Options.endpoints
  • Loading branch information
Ladicek authored Jul 11, 2024
2 parents 6730109 + 3a48bdc commit e3731a3
Show file tree
Hide file tree
Showing 4 changed files with 9 additions and 39 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -40,21 +40,6 @@ static void fromJson(Iterable<java.util.Map.Entry<String, Object>> json, RedisCo
obj.setPassword((String)member.getValue());
}
break;
case "endpoint":
break;
case "connectionStrings":
if (member.getValue() instanceof JsonArray) {
((Iterable<Object>)member.getValue()).forEach( item -> {
if (item instanceof String)
obj.addConnectionString((String)item);
});
}
break;
case "connectionString":
if (member.getValue() instanceof String) {
obj.setConnectionString((String)member.getValue());
}
break;
case "endpoints":
if (member.getValue() instanceof JsonArray) {
java.util.ArrayList<java.lang.String> list = new java.util.ArrayList<>();
Expand Down Expand Up @@ -87,9 +72,6 @@ static void toJson(RedisConnectOptions obj, java.util.Map<String, Object> json)
if (obj.getPassword() != null) {
json.put("password", obj.getPassword());
}
if (obj.getEndpoint() != null) {
json.put("endpoint", obj.getEndpoint());
}
if (obj.getEndpoints() != null) {
JsonArray array = new JsonArray();
obj.getEndpoints().forEach(item -> array.add(item));
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -30,11 +30,6 @@ static void fromJson(Iterable<java.util.Map.Entry<String, Object>> json, RedisOp
obj.setNetClientOptions(new io.vertx.core.net.NetClientOptions((io.vertx.core.json.JsonObject)member.getValue()));
}
break;
case "endpoint":
if (member.getValue() instanceof String) {
obj.setEndpoint((String)member.getValue());
}
break;
case "endpoints":
if (member.getValue() instanceof JsonArray) {
java.util.ArrayList<java.lang.String> list = new java.util.ArrayList<>();
Expand All @@ -45,19 +40,6 @@ static void fromJson(Iterable<java.util.Map.Entry<String, Object>> json, RedisOp
obj.setEndpoints(list);
}
break;
case "connectionStrings":
if (member.getValue() instanceof JsonArray) {
((Iterable<Object>)member.getValue()).forEach( item -> {
if (item instanceof String)
obj.addConnectionString((String)item);
});
}
break;
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());
Expand Down Expand Up @@ -148,9 +130,6 @@ static void toJson(RedisOptions obj, java.util.Map<String, Object> json) {
if (obj.getNetClientOptions() != null) {
json.put("netClientOptions", obj.getNetClientOptions().toJson());
}
if (obj.getEndpoint() != null) {
json.put("endpoint", obj.getEndpoint());
}
if (obj.getEndpoints() != null) {
JsonArray array = new JsonArray();
obj.getEndpoints().forEach(item -> array.add(item));
Expand Down
4 changes: 4 additions & 0 deletions src/main/java/io/vertx/redis/client/RedisConnectOptions.java
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@
package io.vertx.redis.client;

import io.vertx.codegen.annotations.DataObject;
import io.vertx.codegen.annotations.GenIgnore;
import io.vertx.codegen.json.annotations.JsonGen;
import io.vertx.core.json.JsonObject;

Expand Down Expand Up @@ -158,6 +159,7 @@ public RedisConnectOptions setPassword(String password) {
*
* @return the Redis connection string URI
*/
@GenIgnore
public String getEndpoint() {
if (endpoints == null || endpoints.isEmpty()) {
return RedisOptions.DEFAULT_ENDPOINT;
Expand All @@ -175,6 +177,7 @@ public String getEndpoint() {
*
* @see <a href="https://www.iana.org/assignments/uri-schemes/prov/redis">Redis scheme on iana.org</a>
*/
@GenIgnore
public RedisConnectOptions addConnectionString(String connectionString) {
if (endpoints == null) {
endpoints = new ArrayList<>();
Expand All @@ -191,6 +194,7 @@ public RedisConnectOptions addConnectionString(String connectionString) {
* @return fluent self.
* @see <a href="https://www.iana.org/assignments/uri-schemes/prov/redis">Redis scheme on iana.org</a>
*/
@GenIgnore
public RedisConnectOptions setConnectionString(String connectionString) {
if (endpoints == null) {
endpoints = new ArrayList<>();
Expand Down
5 changes: 5 additions & 0 deletions src/main/java/io/vertx/redis/client/RedisOptions.java
Original file line number Diff line number Diff line change
Expand Up @@ -153,6 +153,7 @@ public RedisOptions setNetClientOptions(NetClientOptions netClientOptions) {
*
* @return the Redis connection string URI
*/
@GenIgnore
public String getEndpoint() {
if (endpoints == null || endpoints.isEmpty()) {
return DEFAULT_ENDPOINT;
Expand All @@ -170,6 +171,7 @@ public String getEndpoint() {
* @deprecated see {@link #setConnectionString(String connectionString)} for a better naming
*/
@Deprecated
@GenIgnore
public RedisOptions addEndpoint(String connectionString) {
if (endpoints == null) {
endpoints = new ArrayList<>();
Expand All @@ -187,6 +189,7 @@ public RedisOptions addEndpoint(String connectionString) {
* @deprecated see {@link #setConnectionString(String connectionString)} for a better naming
*/
@Deprecated
@GenIgnore
public RedisOptions setEndpoint(String connectionString) {
if (endpoints == null) {
endpoints = new ArrayList<>();
Expand All @@ -206,6 +209,7 @@ public RedisOptions setEndpoint(String connectionString) {
* @return fluent self.
* @see <a href="https://www.iana.org/assignments/uri-schemes/prov/redis">Redis scheme on iana.org</a>
*/
@GenIgnore
public RedisOptions addConnectionString(String connectionString) {
if (endpoints == null) {
endpoints = new ArrayList<>();
Expand All @@ -222,6 +226,7 @@ public RedisOptions addConnectionString(String connectionString) {
* @return fluent self.
* @see <a href="https://www.iana.org/assignments/uri-schemes/prov/redis">Redis scheme on iana.org</a>
*/
@GenIgnore
public RedisOptions setConnectionString(String connectionString) {
if (endpoints == null) {
endpoints = new ArrayList<>();
Expand Down

0 comments on commit e3731a3

Please sign in to comment.