diff --git a/api/src/main/java/com/alibaba/nacos/api/ability/constant/AbilityKey.java b/api/src/main/java/com/alibaba/nacos/api/ability/constant/AbilityKey.java index d78de35d3..a6d3d691a 100644 --- a/api/src/main/java/com/alibaba/nacos/api/ability/constant/AbilityKey.java +++ b/api/src/main/java/com/alibaba/nacos/api/ability/constant/AbilityKey.java @@ -29,29 +29,33 @@ import java.util.stream.Collectors; * @date 2022/8/31 12:27 **/ public enum AbilityKey { - - /**. - * just for junit test - */ - TEST_1("test_1"), - - /**. - * just for junit test - */ - TEST_2("test_2"); + + TEST_1("test_1", "just for junit test"), + + TEST_2("test_2", "just for junit test"); /**. * the name of a certain ability */ private final String keyName; - - AbilityKey(String name) { + + /** + * description or comment about this ability. + */ + private final String description; + + AbilityKey(String name, String description) { this.keyName = name; + this.description = description; } public String getName() { return keyName; } + + public String getDescription() { + return description; + } /**. * All key set diff --git a/api/src/main/java/com/alibaba/nacos/api/ability/register/impl/ClientAbilities.java b/api/src/main/java/com/alibaba/nacos/api/ability/register/impl/ClientAbilities.java index 3a5a796ce..669bd2ab3 100644 --- a/api/src/main/java/com/alibaba/nacos/api/ability/register/impl/ClientAbilities.java +++ b/api/src/main/java/com/alibaba/nacos/api/ability/register/impl/ClientAbilities.java @@ -37,11 +37,10 @@ public class ClientAbilities extends AbstractAbilityRegistry { * The key is from

AbilityKey

, the value is whether turn on. * * You can add a new public field in

AbilityKey

like: - * DATA_COMPRESSION("compression", 1) - * This field can be used outside, and the offset should be unique. + * DATA_COMPRESSION("compression", "description about this ability") * * And then you need to declare whether turn on in the ability table, you can: - * supportedAbilities.put(AbilityKey.DATA_COMPRESSION, true); means that current client support AbilityKey.DATA_COMPRESSION. + * supportedAbilities.put(AbilityKey.DATA_COMPRESSION, true); means that current client support compression. * */ // put ability here, which you want current client supports diff --git a/api/src/main/java/com/alibaba/nacos/api/ability/register/impl/ServerAbilities.java b/api/src/main/java/com/alibaba/nacos/api/ability/register/impl/ServerAbilities.java index 66a6fbfa0..456b9f906 100644 --- a/api/src/main/java/com/alibaba/nacos/api/ability/register/impl/ServerAbilities.java +++ b/api/src/main/java/com/alibaba/nacos/api/ability/register/impl/ServerAbilities.java @@ -37,11 +37,10 @@ public class ServerAbilities extends AbstractAbilityRegistry { * The key is from

AbilityKey

, the value is whether turn on. * * You can add a new public field in

AbilityKey

like: - * DATA_COMPRESSION("compression", 1) - * This field can be used outside, and the offset should be unique. + * DATA_COMPRESSION("compression", "description about this ability") * * And then you need to declare whether turn on in the ability table, you can: - * supportedAbilities.put(AbilityKey.DATA_COMPRESSION, true); means that current client support AbilityKey.DATA_COMPRESSION. + * supportedAbilities.put(AbilityKey.DATA_COMPRESSION, true); means that current client support compression. * */ // put ability here, which you want current server supports