- java.lang.Object
-
- java.lang.Enum<CaseConversion>
-
- io.github.mmm.base.text.CaseConversion
-
- All Implemented Interfaces:
Serializable,Comparable<CaseConversion>
public enum CaseConversion extends Enum<CaseConversion>
Represents the different character cases and allowsconversion.- Since:
- 7.4.0
- Author:
- Joerg Hohwiller (hohwille at users.sourceforge.net)
-
-
Enum Constant Summary
Enum Constants Enum Constant Description LOWER_CASEConvertto lower case.ORIGINAL_CASEDo not convert (keep original case).UPPER_CASEConvertto upper case.
-
Field Summary
Fields Modifier and Type Field Description static charEXAMPLE_CHAR_FOR_ORIGINAL_CASEThe character representingORIGINAL_CASEinexamples.
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description static booleanareIncompatible(CaseConversion case1, CaseConversion case2)charasExample(char c)charconvert(char c)Stringconvert(String string)Stringconvert(String string, Locale locale)static booleanisCaseChange(CaseConversion caseConversion)static CaseConversionofExample(char c, boolean strict)static CaseConversionvalueOf(String name)Returns the enum constant of this type with the specified name.static CaseConversion[]values()Returns an array containing the constants of this enum type, in the order they are declared.
-
-
-
Enum Constant Detail
-
LOWER_CASE
public static final CaseConversion LOWER_CASE
Convertto lower case.
-
UPPER_CASE
public static final CaseConversion UPPER_CASE
Convertto upper case.
-
ORIGINAL_CASE
public static final CaseConversion ORIGINAL_CASE
Do not convert (keep original case).
-
-
Field Detail
-
EXAMPLE_CHAR_FOR_ORIGINAL_CASE
public static final char EXAMPLE_CHAR_FOR_ORIGINAL_CASE
The character representingORIGINAL_CASEinexamples. Was chosen so it can be used in java names (including packages), paths and URIs but is unlikely to conflict with other semantical usage. However, this choice is arbitrarily.- See Also:
- Constant Field Values
-
-
Method Detail
-
values
public static CaseConversion[] 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 (CaseConversion c : CaseConversion.values()) System.out.println(c);
- Returns:
- an array containing the constants of this enum type, in the order they are declared
-
valueOf
public static CaseConversion valueOf(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:
IllegalArgumentException- if this enum type has no constant with the specified nameNullPointerException- if the argument is null
-
convert
public String convert(String string, Locale locale)
- Parameters:
string- the originalString.locale- the explicitLocaleto use. In most cases you want to useconvert(String)instead.- Returns:
- the converted
String.
-
convert
public char convert(char c)
- Parameters:
c- the original character.- Returns:
- the converted character.
-
asExample
public char asExample(char c)
- Parameters:
c- the character toconvert.- Returns:
- the
convertedcharactercbutEXAMPLE_CHAR_FOR_ORIGINAL_CASEif this isORIGINAL_CASE.
-
ofExample
public static CaseConversion ofExample(char c, boolean strict)
- Parameters:
c- the example character.strict- if the character has to be an upper/lower case letter orEXAMPLE_CHAR_FOR_ORIGINAL_CASE.- Returns:
UPPER_CASEif the given character isupper case,LOWER_CASEif the given character islower case, andORIGINAL_CASEotherwise (might need to be remapped or handled specially).
-
isCaseChange
public static boolean isCaseChange(CaseConversion caseConversion)
- Parameters:
caseConversion- theCaseConversionto test. May benull.- Returns:
trueif the givenCaseConversionisLOWER_CASEorUPPER_CASE.
-
areIncompatible
public static boolean areIncompatible(CaseConversion case1, CaseConversion case2)
- Parameters:
case1- the firstCaseConversion.case2- the secondCaseConversion.- Returns:
trueif bothCaseConversions are incompatible to each other. This means they are not same and are bothcase changing. Otherwisefalse.
-
-