From 8d7af365742268ad8f6d74fb7d821a1b0f97959b Mon Sep 17 00:00:00 2001 From: Paul Campbell Date: Thu, 1 Dec 2016 10:00:19 +0000 Subject: [PATCH] README.md: EnumValueNameCheck: clarify distinction between Value and Class enumerations --- README.md | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) diff --git a/README.md b/README.md index 6292a06..b1ace2f 100644 --- a/README.md +++ b/README.md @@ -2384,7 +2384,14 @@ Accepts `java.util.logging.Logger` and `org.slf4j.Logger`. #### [EnumValueName](http://sevntu-checkstyle.github.io/sevntu.checkstyle/apidocs/com/github/sevntu/checkstyle/checks/naming/EnumValueNameCheck.html) -Forces Enum values to be all upper-case when the enum has no methods or fields, otherwise the values must must be either all upper-case or must match the class naming format. +Enums are considered to be of two distinct types: 'Class' or 'Value' enumerations. The distinction being that Class Enumerations have methods (other than `toString()`) defined. + +The values defined in the `enum` must much the appropriate pattern: + +* Class: `^[A-Z][a-zA-Z0-9]*$` +* Value: `^[A-Z][A-Z0-9]*(_[A-Z0-9]+)*$` + +The difference being that Class enumerations can't contain underscores but can include lowercase letters (after the first initial capital). Value enumerations can include underscores, but not as the first or second character. Valid: ```` @@ -2410,7 +2417,7 @@ Invalid: ```` enum InvalidConstants { - alpha, Beta; + alpha, Beta, GAMMA_RAY; } enum InvalidClassLike {