Package org.openrewrite.internal
Enum NameCaseConvention
- java.lang.Object
-
- java.lang.Enum<NameCaseConvention>
-
- org.openrewrite.internal.NameCaseConvention
-
- All Implemented Interfaces:
java.io.Serializable,java.lang.Comparable<NameCaseConvention>
@Incubating(since="7.17.0") public enum NameCaseConvention extends java.lang.Enum<NameCaseConvention>
Utilities for standard name case conventions.
-
-
Enum Constant Summary
Enum Constants Enum Constant Description LOWER_CAMELCamel case with the first letter lowercase, e.g., "lowerCamel".LOWER_HYPHENLowercase and hyphen-separated, e.g., "lower-hyphen".LOWER_UNDERSCORELowercase and underscore-separated, e.g., "lower_underscore".UPPER_CAMELCamel case with the first letter uppercase, e.g., "UpperCamel".UPPER_UNDERSCOREUnderscore separated with all letters uppercase, e.g., "UPPER_UNDERSCORE".
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description static booleanequalsRelaxedBinding(java.lang.String str0, java.lang.String str1)Check equality between two inputs using "relaxed binding" rules.java.lang.Stringformat(java.lang.String str)Formats the input to the style of thisNameCaseConvention.static java.lang.Stringformat(NameCaseConvention convention, java.lang.String str)booleanmatches(java.lang.String str)Whether the input matches the formatting style of thisNameCaseConvention.static booleanmatches(NameCaseConvention convention, java.lang.String str)static NameCaseConventionvalueOf(java.lang.String name)Returns the enum constant of this type with the specified name.static NameCaseConvention[]values()Returns an array containing the constants of this enum type, in the order they are declared.
-
-
-
Enum Constant Detail
-
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 Detail
-
values
public static NameCaseConvention[] values()
Returns an array containing the constants of this enum type, in the order they are declared. This method may be used to iterate over the constants as follows:for (NameCaseConvention c : NameCaseConvention.values()) System.out.println(c);
- Returns:
- an array containing the constants of this enum type, in the order they are declared
-
valueOf
public static NameCaseConvention valueOf(java.lang.String name)
Returns the enum constant of this type with the specified name. The string must match exactly an identifier used to declare an enum constant in this type. (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:
java.lang.IllegalArgumentException- if this enum type has no constant with the specified namejava.lang.NullPointerException- if the argument is null
-
format
public java.lang.String format(java.lang.String str)
Formats the input to the style of thisNameCaseConvention.- Parameters:
str- The input string to format.- Returns:
- The string formatted to the style of this convention.
-
format
public static java.lang.String format(NameCaseConvention convention, java.lang.String str)
-
matches
public boolean matches(java.lang.String str)
Whether the input matches the formatting style of thisNameCaseConvention.- 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, java.lang.String str)
-
equalsRelaxedBinding
public static boolean equalsRelaxedBinding(java.lang.String str0, java.lang.String str1)Check equality between two inputs using "relaxed binding" rules. The inputs will be converted toLOWER_CAMELbefore being checked usingString.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:
- Micronaut Property Value Binding Normalization, Spring Boot Relaxed Binding
-
-