Enum Class StringConvention
- All Implemented Interfaces:
Serializable
,Comparable<StringConvention>
,Constable
An enum representing different conventions.
- Since:
- 1.0
- Author:
- graemerocher
-
Nested Class Summary
Nested classes/interfaces inherited from class java.lang.Enum
Enum.EnumDesc<E extends Enum<E>>
-
Enum Constant Summary
Enum ConstantDescriptionCamel case, lower case first letter.Camel case capitalized like class names.Hyphenated, in lower case.Raw unconverted string.Hyphenated, in upper case.Hyphenated, in lower case. -
Method Summary
Modifier and TypeMethodDescriptionstatic String
format
(StringConvention convention, String str) Format a string according to a convention.Format the string with this format.static StringConvention
Returns the enum constant of this class with the specified name.static StringConvention[]
values()
Returns an array containing the constants of this enum class, in the order they are declared.
-
Enum Constant Details
-
CAMEL_CASE_CAPITALIZED
Camel case capitalized like class names. Example: FooBar -
CAMEL_CASE
Camel case, lower case first letter. Example: fooBar -
HYPHENATED
Hyphenated, in lower case. Example foo-bar -
RAW
Raw unconverted string. -
UNDER_SCORE_SEPARATED
Hyphenated, in upper case. Example FOO_BAR -
UNDER_SCORE_SEPARATED_LOWER_CASE
Hyphenated, in lower case. Example foo_bar
-
-
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
Format the string with this format.- Parameters:
str
- The string- Returns:
- The formatted string
-
format
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
-