Enum Class NameCaseConvention

java.lang.Object
java.lang.Enum<NameCaseConvention>
org.openrewrite.internal.NameCaseConvention
All Implemented Interfaces:
Serializable, Comparable<NameCaseConvention>, Constable

@Incubating(since="7.17.0") public enum NameCaseConvention extends Enum<NameCaseConvention>
Utilities for standard name case conventions.
  • Enum Constant Details

    • LOWER_HYPHEN

      public static final NameCaseConvention LOWER_HYPHEN
      Lowercase and hyphen-separated, e.g., "lower-hyphen". This is also known as "kebab-case".
    • LOWER_UNDERSCORE

      public static final NameCaseConvention LOWER_UNDERSCORE
      Lowercase and underscore-separated, e.g., "lower_underscore". This is also known as "snake_case".
    • LOWER_CAMEL

      public static final NameCaseConvention LOWER_CAMEL
      Camel case with the first letter lowercase, e.g., "lowerCamel". This is the standard Java variable naming convention.
    • UPPER_CAMEL

      public static final NameCaseConvention UPPER_CAMEL
      Camel case with the first letter uppercase, e.g., "UpperCamel". This is the standard Java and C++ class naming convention.
    • UPPER_UNDERSCORE

      public static final NameCaseConvention UPPER_UNDERSCORE
      Underscore separated with all letters uppercase, e.g., "UPPER_UNDERSCORE". This is the standard Java and C++ constant variable naming convention. This is also known as "SCREAMING_SNAKE_CASE".
  • Method Details

    • values

      public static NameCaseConvention[] 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 NameCaseConvention 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
    • format

      public String format(String str)
      Formats the input to the style of this NameCaseConvention.
      Parameters:
      str - The input string to format.
      Returns:
      The string formatted to the style of this convention.
    • format

      public static String format(NameCaseConvention convention, String str)
    • matches

      public boolean matches(String str)
      Whether the input matches the formatting style of this NameCaseConvention.
      Parameters:
      str - The input string to check.
      Returns:
      Whether the input matches the formatting style of this convention.
    • matches

      public static boolean matches(NameCaseConvention convention, String str)
    • equalsRelaxedBinding

      public static boolean equalsRelaxedBinding(String str0, String str1)
      Check equality between two inputs using "relaxed binding" rules. The inputs will be converted to LOWER_CAMEL before being checked using String.equals(java.lang.Object).
      Parameters:
      str0 - The first input to compare.
      str1 - The second input to compare.
      Returns:
      Whether the inputs are equal.
      See Also:
    • matchesGlobRelaxedBinding

      public static boolean matchesGlobRelaxedBinding(String test, String pattern)
      Check equality between two inputs using "relaxed binding" rules. The inputs will be converted to LOWER_CAMEL before being checked using String.equals(java.lang.Object).
      Parameters:
      test - The property to test.
      pattern - A glob pattern.
      Returns:
      Whether the inputs are equal.
      See Also:
    • matchesRegexRelaxedBinding

      public static boolean matchesRegexRelaxedBinding(String test, String pattern)