Package org.apache.rat.utils
Enum CasedString.StringCase
- All Implemented Interfaces:
Serializable
,Comparable<CasedString.StringCase>
- Enclosing class:
CasedString
An enumeration of supported string cases. These cases tag strings as having a specific format.
-
Enum Constant Summary
Enum ConstantsEnum ConstantDescriptionCamel case tags strings like 'CamelCase' or 'camelCase'.Dot case tags phrases of words like 'phrase.case'.Kebab case tags strings like 'kebab-case'.Phrase case tags phrases of words like 'phrase case'.Snake case tags strings like 'Snake_Case'. -
Method Summary
Modifier and TypeMethodDescriptionCreates a cased string from a collection of segments.String[]
getSegments
(String string) Returns an array of each of the segments in this CasedString.static CasedString.StringCase
Returns the enum constant of this type with the specified name.static CasedString.StringCase[]
values()
Returns an array containing the constants of this enum type, in the order they are declared.
-
Enum Constant Details
-
CAMEL
Camel case tags strings like 'CamelCase' or 'camelCase'. This conversion forces the first character to lower case. If specific capitalization rules are required useWordUtils.capitalize(String)
to set the first character of the string. -
SNAKE
Snake case tags strings like 'Snake_Case'. This conversion does not change the capitalization of any characters in the string. If specific capitalization is required useString.toUpperCase()
,String.toLowerCase()
, or the commons-text methodsWordUtils.capitalize(String)
, orWordUtils.uncapitalize(String)
as required. -
KEBAB
Kebab case tags strings like 'kebab-case'. This conversion does not change the capitalization of any characters in the string. If specific capitalization is required useString.toUpperCase()
,String.toLowerCase()
, * or the commons-text methodsWordUtils.capitalize(String)
, orWordUtils.uncapitalize(String)
as required. -
PHRASE
Phrase case tags phrases of words like 'phrase case'. This conversion does not change the capitalization of any characters in the string. If specific capitalization is required useString.toUpperCase()
,String.toLowerCase()
, * or the commons-text methodsWordUtils.capitalize(String)
, orWordUtils.uncapitalize(String)
as required. -
DOT
Dot case tags phrases of words like 'phrase.case'. This conversion does not change the capitalization of any characters in the string. If specific capitalization is required useString.toUpperCase()
,String.toLowerCase()
, * or the commons-text methodsWordUtils.capitalize(String)
, orWordUtils.uncapitalize(String)
as required.
-
-
Method Details
-
values
Returns an array containing the constants of this enum type, in the order they are declared.- Returns:
- an array containing the constants of this enum type, in the order they are declared
-
valueOf
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:
IllegalArgumentException
- if this enum type has no constant with the specified nameNullPointerException
- if the argument is null
-
assemble
Creates a cased string from a collection of segments.- Parameters:
segments
- the segments to create the CasedString from.- Returns:
- a CasedString
-
getSegments
Returns an array of each of the segments in this CasedString. Segments are defined as the strings between the separators in the CasedString. For the CAMEL case the segments are determined by the presence of a capital letter.- Returns:
- the array of Strings that are segments of the cased string.
-