Enums

API

Enums.java
class Enums {
  String getFriendlyNameOf(Enum<?> anEnum)
  String getFriendlyNameOf(String anEnumName)
  String getEnumNameFromFriendly(String anEnumFriendlyName)
  String enumToHttpHeader(Enum<?> anEnum)
  String enumNameToHttpHeader(String name)
  String enumToCamelCase(Enum<?> anEnum)
  Optional<T> parseFriendlyName(Class<T> correspondingClass, String text)
}

For example:

public enum PaymentMethod {

    VISA,
    MASTERCARD,
    AMERICAN_EXPRESS,
    PAY_PAL,
    BITCOIN,
    ;

    public String title() {
        return Enums.getFriendlyNameOf(this);
    }
}