Interface NamingStrategy
- All Known Implementing Classes:
SnakeCaseNamingStrategy
,TransformingNamingStrategy
public interface NamingStrategy
Interface and default implementation of a naming strategy. Defaults to table name based on
Class
and column
name based on property names. Names are used as-is without quoting. Lower-case, non-keyword names are used without
quoting. Upper-case, keyword or other names requiring quoting are used with quotes.
NOTE: Can also be used as an adapter. Create a lambda or an anonymous subclass and override any settings to implement a different strategy on the fly.
- Since:
- 3.0
- Author:
- Mark Paluch
-
Field Summary
FieldsModifier and TypeFieldDescriptionstatic final NamingStrategy
Empty implementation of the interface utilizing only the default implementation.static final NamingStrategy
Default implementation converting all names toString.toLowerCase()
.static final NamingStrategy
Naming strategy that renders CamelCase name parts tosnake_case
. -
Method Summary
Modifier and TypeMethodDescriptiondefault String
getColumnName
(CassandraPersistentProperty property) Create a column name from the givenproperty
.default String
getTableName
(CassandraPersistentEntity<?> entity) Create a table name from the givenCassandraPersistentEntity
.default String
getUserDefinedTypeName
(CassandraPersistentEntity<?> entity) Create a user-defined type name from the givenCassandraPersistentEntity
.default NamingStrategy
transform
(UnaryOperator<String> mappingFunction) Apply atransformation function
to create a newNamingStrategy
that applies the given transformation to each name component.
-
Field Details
-
CASE_SENSITIVE
Empty implementation of the interface utilizing only the default implementation.Using this avoids creating essentially the same class over and over again.
- Since:
- 3.3.6
-
INSTANCE
Default implementation converting all names toString.toLowerCase()
. -
SNAKE_CASE
Naming strategy that renders CamelCase name parts tosnake_case
.
-
-
Method Details
-
getTableName
Create a table name from the givenCassandraPersistentEntity
. -
getUserDefinedTypeName
Create a user-defined type name from the givenCassandraPersistentEntity
. -
getColumnName
Create a column name from the givenproperty
. -
transform
Apply atransformation function
to create a newNamingStrategy
that applies the given transformation to each name component. Example:NamingStrategy lower = NamingStrategy.INSTANCE.transform(String::toLowerCase);
- Parameters:
mappingFunction
- must not be null.- Returns:
- the
NamingStrategy
that applies the giventransformation function
.
-