Correct comment and add description for AbilityKey (#10760)

* correct the comments

* correct the comments and add description field for AbilityKey.
This commit is contained in:
chenyiqin 2023-07-11 17:15:52 +08:00 committed by GitHub
parent 21173873f3
commit d6958ab27c
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 22 additions and 20 deletions

View File

@ -30,29 +30,33 @@ import java.util.stream.Collectors;
**/
public enum AbilityKey {
/**.
* just for junit test
*/
TEST_1("test_1"),
TEST_1("test_1", "just for junit test"),
/**.
* just for junit test
*/
TEST_2("test_2");
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
*/

View File

@ -37,11 +37,10 @@ public class ClientAbilities extends AbstractAbilityRegistry {
* The key is from <p>AbilityKey</p>, the value is whether turn on.
*
* You can add a new public field in <p>AbilityKey</p> like:
* <code>DATA_COMPRESSION("compression", 1)</code>
* This field can be used outside, and the offset should be unique.
* <code>DATA_COMPRESSION("compression", "description about this ability")</code>
*
* And then you need to declare the offset of the flag bit of this ability in the ability table, you can:
* <code>supportedAbilities.put(AbilityKey.DATA_COMPRESSION, true);</code> means that is the first bit from left to right in the table.
* And then you need to declare whether turn on in the ability table, you can:
* <code>supportedAbilities.put(AbilityKey.DATA_COMPRESSION, true);</code> means that current client support compression.
*
*/
// put ability here, which you want current client supports

View File

@ -37,11 +37,10 @@ public class ServerAbilities extends AbstractAbilityRegistry {
* The key is from <p>AbilityKey</p>, the value is whether turn on.
*
* You can add a new public field in <p>AbilityKey</p> like:
* <code>DATA_COMPRESSION("compression", 1)</code>
* This field can be used outside, and the offset should be unique.
* <code>DATA_COMPRESSION("compression", "description about this ability")</code>
*
* And then you need to declare the offset of the flag bit of this ability in the ability table, you can:
* <code>supportedAbilities.put(AbilityKey.DATA_COMPRESSION, true);</code> means that is the first bit from left to right in the table.
* And then you need to declare whether turn on in the ability table, you can:
* <code>supportedAbilities.put(AbilityKey.DATA_COMPRESSION, true);</code> means that current client support compression.
*
*/
// put ability here, which you want current server supports