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.
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
Modifier and TypeFieldDescriptionstatic final NamingStrategy
Empty implementation of the interface utilizing only the default implementation.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
-
INSTANCE
Empty implementation of the interface utilizing only the default implementation.Using this avoids creating essentially the same class over and over again.
-
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
.
-