- All Implemented Interfaces:
Serializable,Comparable<NamingType>,Constable
This enum provides strategies for automatically deriving database table names from entity
class names when Table.name() is not specified, and for deriving database column names
from entity property names when Column.name() is not specified.
Naming conventions are essential for maintaining consistent naming patterns between Java code and database schemas, especially in applications that follow specific naming standards.
- See Also:
-
Nested Class Summary
Nested classes/interfaces inherited from class java.lang.Enum
Enum.EnumDesc<E extends Enum<E>> -
Enum Constant Summary
Enum ConstantsEnum ConstantDescriptionConverts camel case text to all lowercase text without adding underscores.Preserves the original name without any conversion.Converts camel case text to snake case with lowercase letters.Converts camel case text to snake case with uppercase letters.Converts camel case text to all uppercase text without adding underscores. -
Method Summary
Modifier and TypeMethodDescriptionabstract StringApplies this naming convention to convert a Java identifier to a database identifier.abstract StringAttempts to convert a database identifier back to its original Java identifier form.static NamingTypeReturns the enum constant of this class with the specified name.static NamingType[]values()Returns an array containing the constants of this enum class, in the order they are declared.
-
Enum Constant Details
-
NONE
Preserves the original name without any conversion.This naming convention leaves entity and property names unchanged when mapping to table and column names. Use this when your Java naming conventions already match your database naming conventions.
-
SNAKE_UPPER_CASE
Converts camel case text to snake case with uppercase letters.This naming convention transforms Java camelCase identifiers to database-style SNAKE_CASE identifiers with all uppercase letters. This is commonly used in databases that follow uppercase naming conventions.
Examples:
aaaBbbis converted toAAA_BBBaaa3Bbbis converted toAAA3_BBB
- See Also:
-
SNAKE_LOWER_CASE
Converts camel case text to snake case with lowercase letters.This naming convention transforms Java camelCase identifiers to database-style snake_case identifiers with all lowercase letters. This is commonly used in databases that follow lowercase naming conventions.
Examples:
aaaBbbis converted toaaa_bbbaaa3Bbbis converted toaaa3_bbb
- See Also:
-
UPPER_CASE
Converts camel case text to all uppercase text without adding underscores.This naming convention transforms Java camelCase identifiers to database-style identifiers with all uppercase letters, but without adding underscores between words.
Example:
aaaBbbis converted toAAABBB
- See Also:
-
LOWER_CASE
Converts camel case text to all lowercase text without adding underscores.This naming convention transforms Java camelCase identifiers to database-style identifiers with all lowercase letters, but without adding underscores between words.
Example:
aaaBbbis converted toaaabbb
- See Also:
-
-
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
-
apply
Applies this naming convention to convert a Java identifier to a database identifier.This method is used to convert entity class names to table names and entity property names to column names according to the specific naming convention.
- Parameters:
text- the entity name or property name to convert- Returns:
- the converted table name or column name
- Throws:
DomaNullPointerException- if the text isnull
-
revert
Attempts to convert a database identifier back to its original Java identifier form.This method performs the reverse operation of
apply(String), converting database table and column names back to their corresponding Java entity and property names. The conversion may not be perfect for all naming conventions.- Parameters:
text- the database table or column name to convert back- Returns:
- the Java entity or property name
- Throws:
DomaNullPointerException- if the text isnull
-