forked from Fascinated/Bat
impl channel create and delete logging
This commit is contained in:
21
src/main/java/cc/fascinated/bat/common/EnumUtils.java
Normal file
21
src/main/java/cc/fascinated/bat/common/EnumUtils.java
Normal file
@ -0,0 +1,21 @@
|
||||
package cc.fascinated.bat.common;
|
||||
|
||||
/**
|
||||
* @author Fascinated (fascinated7)
|
||||
*/
|
||||
public class EnumUtils {
|
||||
/**
|
||||
* Gets the name of the enum
|
||||
*
|
||||
* @param e the enum
|
||||
* @return the name
|
||||
*/
|
||||
public static String getEnumName(Enum<?> e) {
|
||||
String[] split = e.name().split("_");
|
||||
StringBuilder builder = new StringBuilder();
|
||||
for (String s : split) {
|
||||
builder.append(s.substring(0, 1).toUpperCase()).append(s.substring(1).toLowerCase()).append(" ");
|
||||
}
|
||||
return builder.toString().trim();
|
||||
}
|
||||
}
|
Reference in New Issue
Block a user