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 NamingStrategyEmpty implementation of the interface utilizing only the default implementation.static final NamingStrategyDefault implementation converting all names toString.toLowerCase().static final NamingStrategyNaming strategy that renders CamelCase name parts tosnake_case. -
Method Summary
Modifier and TypeMethodDescriptiondefault StringgetColumnName(CassandraPersistentProperty property) Create a column name from the givenproperty.default StringgetTableName(CassandraPersistentEntity<?> entity) Create a table name from the givenCassandraPersistentEntity.default StringgetUserDefinedTypeName(CassandraPersistentEntity<?> entity) Create a user-defined type name from the givenCassandraPersistentEntity.default NamingStrategytransform(UnaryOperator<String> mappingFunction) Apply atransformation functionto create a newNamingStrategythat 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 functionto create a newNamingStrategythat applies the given transformation to each name component. Example:NamingStrategy lower = NamingStrategy.INSTANCE.transform(String::toLowerCase);
- Parameters:
mappingFunction- must not be null.- Returns:
- the
NamingStrategythat applies the giventransformation function.
-