Enum StringConvention
- java.lang.Object
-
- java.lang.Enum<StringConvention>
-
- io.micronaut.core.naming.conventions.StringConvention
-
- All Implemented Interfaces:
java.io.Serializable
,java.lang.Comparable<StringConvention>
public enum StringConvention extends java.lang.Enum<StringConvention>
An enum representing different conventions.- Since:
- 1.0
-
-
Enum Constant Summary
Enum Constants Enum Constant Description CAMEL_CASE
Camel case, lower case first letter.CAMEL_CASE_CAPITALIZED
Camel case capitalized like class names.HYPHENATED
Hyphenated, in lower case.RAW
Raw unconverted string.UNDER_SCORE_SEPARATED
Hyphenated, in upper case.UNDER_SCORE_SEPARATED_LOWER_CASE
Hyphenated, in lower case.
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description static java.lang.String
format(StringConvention convention, java.lang.String str)
Format a string according to a convention.java.lang.String
format(java.lang.String str)
Format the string with this format.static StringConvention
valueOf(java.lang.String name)
Returns the enum constant of this type with the specified name.static StringConvention[]
values()
Returns an array containing the constants of this enum type, in the order they are declared.
-
-
-
Enum Constant Detail
-
CAMEL_CASE_CAPITALIZED
public static final StringConvention CAMEL_CASE_CAPITALIZED
Camel case capitalized like class names. Example: FooBar
-
CAMEL_CASE
public static final StringConvention CAMEL_CASE
Camel case, lower case first letter. Example: fooBar
-
HYPHENATED
public static final StringConvention HYPHENATED
Hyphenated, in lower case. Example foo-bar
-
RAW
public static final StringConvention RAW
Raw unconverted string.
-
UNDER_SCORE_SEPARATED
public static final StringConvention UNDER_SCORE_SEPARATED
Hyphenated, in upper case. Example FOO_BAR
-
UNDER_SCORE_SEPARATED_LOWER_CASE
public static final StringConvention UNDER_SCORE_SEPARATED_LOWER_CASE
Hyphenated, in lower case. Example foo_bar
-
-
Method Detail
-
values
public static StringConvention[] 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 (StringConvention c : StringConvention.values()) System.out.println(c);
- Returns:
- an array containing the constants of this enum type, in the order they are declared
-
valueOf
public static StringConvention 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)
Format the string with this format.- Parameters:
str
- The string- Returns:
- The formatted string
-
format
public static java.lang.String format(StringConvention convention, java.lang.String str)
Format a string according to a convention.- Parameters:
convention
- The string convention to usestr
- The string to format- Returns:
- The formatted string based on the convention
-
-