Enum Class CaseConversion

java.lang.Object
java.lang.Enum<CaseConversion>
io.github.mmm.base.text.CaseConversion
All Implemented Interfaces:
Serializable, Comparable<CaseConversion>, Constable

public enum CaseConversion extends Enum<CaseConversion>
Represents the different character cases and allows conversion.
Since:
1.0.0
  • Enum Constant Details

  • Field Details

    • EXAMPLE_CHAR_FOR_ORIGINAL_CASE

      public static final char EXAMPLE_CHAR_FOR_ORIGINAL_CASE
      The character representing ORIGINAL_CASE in examples. Was chosen so it can be used in java names (including packages), paths and URIs but is unlikely to conflict with other semantical usage. However, this choice is arbitrarily.
      See Also:
  • Method Details

    • values

      public static CaseConversion[] 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 CaseConversion 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
    • convert

      public String convert(String string)
      Parameters:
      string - the original String.
      Returns:
      the converted String.
    • convert

      public String convert(String string, Locale locale)
      Parameters:
      string - the original String.
      locale - the explicit Locale to use. In most cases you want to use convert(String) instead.
      Returns:
      the converted String.
    • convert

      public char convert(char c)
      Parameters:
      c - the original character.
      Returns:
      the converted character.
    • asExample

      public char asExample(char c)
      Parameters:
      c - the character to convert.
      Returns:
      the converted character c but EXAMPLE_CHAR_FOR_ORIGINAL_CASE if this is ORIGINAL_CASE.
    • ofExample

      public static CaseConversion ofExample(char c, boolean strict)
      Parameters:
      c - the example character.
      strict - if the character has to be an upper/lower case letter or EXAMPLE_CHAR_FOR_ORIGINAL_CASE.
      Returns:
      UPPER_CASE if the given character is upper case, LOWER_CASE if the given character is lower case, and ORIGINAL_CASE otherwise (might need to be remapped or handled specially).
    • isCaseChange

      public static boolean isCaseChange(CaseConversion caseConversion)
      Parameters:
      caseConversion - the CaseConversion to test. May be null.
      Returns:
      true if the given CaseConversion is LOWER_CASE or UPPER_CASE.
    • areIncompatible

      public static boolean areIncompatible(CaseConversion case1, CaseConversion case2)
      Parameters:
      case1 - the first CaseConversion.
      case2 - the second CaseConversion.
      Returns:
      true if both CaseConversions are incompatible to each other. This means they are not same and are both case changing. Otherwise false.