Code example for CaseFormat

Methods: to

0
public enum ServerState { 
 
   ON, STARTING, OFF, STOPPING, RESTARTING, SAVING, RESTORING, UPDATING, UNRECOGNIZED;
 
   public String value() {
      return CaseFormat.UPPER_UNDERSCORE.to(CaseFormat.UPPER_CAMEL, name());
   } 
 
   @Override 
   public String toString() {
      return value(); 
   } 
 
   public static ServerState fromValue(String state) {
      try { 
         return valueOf(CaseFormat.UPPER_CAMEL.to(CaseFormat.UPPER_UNDERSCORE, checkNotNull(state, "state")));
      } catch (IllegalArgumentException e) {
         return UNRECOGNIZED;
      } 
   } 
Contextual code suggestions in your IDE  Get Codota for Java