@GwtCompatible public enum CaseFormat extends java.lang.Enum<CaseFormat>
Modifier and Type | Class and Description |
---|---|
private static class |
CaseFormat.StringConverter |
Enum Constant and Description |
---|
LOWER_CAMEL
Java variable naming convention, e.g., "lowerCamel".
|
LOWER_HYPHEN
Hyphenated variable naming convention, e.g., "lower-hyphen".
|
LOWER_UNDERSCORE
C++ variable naming convention, e.g., "lower_underscore".
|
UPPER_CAMEL
Java and C++ class naming convention, e.g., "UpperCamel".
|
UPPER_UNDERSCORE
Java and C++ constant naming convention, e.g., "UPPER_UNDERSCORE".
|
Modifier and Type | Field and Description |
---|---|
private CharMatcher |
wordBoundary |
private java.lang.String |
wordSeparator |
Modifier and Type | Method and Description |
---|---|
(package private) java.lang.String |
convert(CaseFormat format,
java.lang.String s)
Enum values can override for performance reasons.
|
Converter<java.lang.String,java.lang.String> |
converterTo(CaseFormat targetFormat)
Returns a
Converter that converts strings from this format to targetFormat . |
private static java.lang.String |
firstCharOnlyToUpper(java.lang.String word) |
private java.lang.String |
normalizeFirstWord(java.lang.String word) |
(package private) abstract java.lang.String |
normalizeWord(java.lang.String word) |
java.lang.String |
to(CaseFormat format,
java.lang.String str)
Converts the specified
String str from this format to the specified format . |
static CaseFormat |
valueOf(java.lang.String name)
Returns the enum constant of this type with the specified name.
|
static CaseFormat[] |
values()
Returns an array containing the constants of this enum type, in
the order they are declared.
|
public static final CaseFormat LOWER_HYPHEN
public static final CaseFormat LOWER_UNDERSCORE
public static final CaseFormat LOWER_CAMEL
public static final CaseFormat UPPER_CAMEL
public static final CaseFormat UPPER_UNDERSCORE
private final CharMatcher wordBoundary
private final java.lang.String wordSeparator
public static CaseFormat[] values()
for (CaseFormat c : CaseFormat.values()) System.out.println(c);
public static CaseFormat valueOf(java.lang.String name)
name
- the name of the enum constant to be returned.java.lang.IllegalArgumentException
- if this enum type has no constant with the specified namejava.lang.NullPointerException
- if the argument is nullpublic final java.lang.String to(CaseFormat format, java.lang.String str)
String str
from this format to the specified format
. A
"best effort" approach is taken; if str
does not conform to the assumed format, then
the behavior of this method is undefined but we make a reasonable effort at converting anyway.java.lang.String convert(CaseFormat format, java.lang.String s)
public Converter<java.lang.String,java.lang.String> converterTo(CaseFormat targetFormat)
Converter
that converts strings from this format to targetFormat
.abstract java.lang.String normalizeWord(java.lang.String word)
private java.lang.String normalizeFirstWord(java.lang.String word)
private static java.lang.String firstCharOnlyToUpper(java.lang.String word)