Package org.openrewrite.internal
Enum Class NameCaseConvention
- All Implemented Interfaces:
Serializable
,Comparable<NameCaseConvention>
,Constable
Utilities for standard name case conventions.
-
Nested Class Summary
Nested classes/interfaces inherited from class java.lang.Enum
Enum.EnumDesc<E extends Enum<E>>
-
Enum Constant Summary
Enum ConstantsEnum ConstantDescriptionCamel case with the first letter lowercase, e.g., "lowerCamel".Lowercase and hyphen-separated, e.g., "lower-hyphen".Lowercase and underscore-separated, e.g., "lower_underscore".Camel case with the first letter uppercase, e.g., "UpperCamel".Underscore separated with all letters uppercase, e.g., "UPPER_UNDERSCORE". -
Method Summary
Modifier and TypeMethodDescriptionstatic boolean
equalsRelaxedBinding
(String str0, String str1) Check equality between two inputs using "relaxed binding" rules.Formats the input to the style of thisNameCaseConvention
.static String
format
(NameCaseConvention convention, String str) boolean
Whether the input matches the formatting style of thisNameCaseConvention
.static boolean
matches
(NameCaseConvention convention, String str) static boolean
matchesGlobRelaxedBinding
(String test, String pattern) Check equality between two inputs using "relaxed binding" rules.static boolean
matchesRegexRelaxedBinding
(String test, String pattern) static NameCaseConvention
Returns the enum constant of this class with the specified name.static NameCaseConvention[]
values()
Returns an array containing the constants of this enum class, in the order they are declared.
-
Enum Constant Details
-
LOWER_HYPHEN
Lowercase and hyphen-separated, e.g., "lower-hyphen". This is also known as "kebab-case". -
LOWER_UNDERSCORE
Lowercase and underscore-separated, e.g., "lower_underscore". This is also known as "snake_case". -
LOWER_CAMEL
Camel case with the first letter lowercase, e.g., "lowerCamel". This is the standard Java variable naming convention. -
UPPER_CAMEL
Camel case with the first letter uppercase, e.g., "UpperCamel". This is the standard Java and C++ class naming convention. -
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
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
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 nameNullPointerException
- if the argument is null
-
format
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
-
matches
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
-
equalsRelaxedBinding
Check equality between two inputs using "relaxed binding" rules. The inputs will be converted toLOWER_CAMEL
before 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:
-
matchesGlobRelaxedBinding
Check equality between two inputs using "relaxed binding" rules. The inputs will be converted toLOWER_CAMEL
before being checked usingString.equals(java.lang.Object)
.- Parameters:
test
- The property to test.pattern
- A glob pattern.- Returns:
- Whether the inputs are equal.
- See Also:
-
matchesRegexRelaxedBinding
-