liuxiaocs7 commented on code in PR #25246:
URL: https://github.com/apache/shardingsphere/pull/25246#discussion_r1175228068
##########
features/sharding/core/src/main/java/org/apache/shardingsphere/sharding/algorithm/sharding/classbased/ClassBasedShardingAlgorithmStrategyType.java:
##########
@@ -25,15 +25,25 @@ public enum ClassBasedShardingAlgorithmStrategyType {
/**
* The sharding strategy is standard.
*/
- STANDARD,
+ STANDARD("STANDARD"),
/**
* The sharding strategy is complex.
*/
- COMPLEX,
+ COMPLEX("COMPLEX"),
/**
* The sharding strategy is hint.
*/
- HINT
+ HINT("HINT");
+
+ private final String type;
+
+ ClassBasedShardingAlgorithmStrategyType(final String type) {
+ this.type = type;
+ }
+
+ static boolean isValidShardingAlgorithmStrategyType(final String type) {
+ return STANDARD.type.equalsIgnoreCase(type) ||
COMPLEX.type.equalsIgnoreCase(type) || HINT.type.equalsIgnoreCase(type);
Review Comment:
> No need to define `type` field, use
>
> ```java
> static boolean isValidShardingAlgorithmStrategyType(final String type) {
> return Arrays.stream(values()).anyMatch(each ->
each.name().equals(type));
> }
> ```
got, thanks!
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]