Enum Class CaseFormat

java.lang.Object
java.lang.Enum<CaseFormat>
io.immutables.common.CaseFormat
All Implemented Interfaces:
Serializable, Comparable<CaseFormat>, Constable

public enum CaseFormat extends Enum<CaseFormat>
Utility class for converting between various case formats. The difference from Guava's version is that it can work with regular unicode-ish support of Character.isUpperCase(char)/String.toLowerCase()/String.toUpperCase() and it will still work probably fine with latin-1 available in new JDKs.
  • Enum Constant Details

    • LowerKebob

      public static final CaseFormat LowerKebob
      Hyphenated variable naming convention, e.g., "lower-hyphen".
    • LowerSnake

      public static final CaseFormat LowerSnake
      C++ variable naming convention, e.g., "lower_underscore".
    • LowerCamel

      public static final CaseFormat LowerCamel
      Java variable naming convention, e.g., "lowerCamel".
    • UpperCamel

      public static final CaseFormat UpperCamel
      Java and C++ class naming convention, e.g., "UpperCamel".
    • UpperSnake

      public static final CaseFormat UpperSnake
      Java and C++ constant naming convention, e.g., "UPPER_UNDERSCORE".
  • Method Details

    • values

      public static CaseFormat[] values()
      Returns an array containing the constants of this enum class, in the order they are declared.
      Returns:
      an array containing the constants of this enum class, in the order they are declared
    • valueOf

      public static CaseFormat valueOf(String name)
      Returns the enum constant of this class with the specified name. The string must match exactly an identifier used to declare an enum constant in this class. (Extraneous whitespace characters are not permitted.)
      Parameters:
      name - the name of the enum constant to be returned.
      Returns:
      the enum constant with the specified name
      Throws:
      IllegalArgumentException - if this enum class has no constant with the specified name
      NullPointerException - if the argument is null
    • to

      public final String to(CaseFormat format, String s)
      Converts the specified String str from this format to the specified format. A "best effort" approach is taken; if str does not conform to the assumed format, then the behavior of this method is undefined, but we make a reasonable effort at converting anyway.