Package io.micronaut.data.model.naming
Interface NamingStrategy
-
- All Known Implementing Classes:
NamingStrategies.KebabCase,NamingStrategies.LowerCase,NamingStrategies.Raw,NamingStrategies.UnderScoreSeparatedLowerCase,NamingStrategies.UnderScoreSeparatedUpperCase,NamingStrategies.UpperCase
- Functional Interface:
- This is a functional interface and can therefore be used as the assignment target for a lambda expression or method reference.
@FunctionalInterface @Introspected public interface NamingStrategyA strategy interface for resolving the mapped name of an entity or property.- Since:
- 1.0
- Author:
- graemerocher
-
-
Field Summary
Fields Modifier and Type Field Description static NamingStrategyDEFAULTConstant for the default under score separated lower case strategy.
-
Method Summary
All Methods Instance Methods Abstract Methods Default Methods Modifier and Type Method Description default java.lang.StringgetForeignKeySuffix()The default foreign key suffix for property names.default java.lang.StringmappedJoinTableColumn(PersistentEntity associated, java.util.List<Association> associations, PersistentProperty property)default java.lang.StringmappedName(Association association)Return the mapped name for the given association.default java.lang.StringmappedName(Embedded embedded, PersistentProperty property)Return the mapped name given anEmbeddedassociation and the property of the association.default java.lang.StringmappedName(PersistentEntity entity)Return the mapped name for the given entity.default java.lang.StringmappedName(PersistentProperty property)Return the mapped name for the given property.java.lang.StringmappedName(java.lang.String name)Return the mapped name for the given name.default java.lang.StringmappedName(java.util.List<Association> associations, PersistentProperty property)
-
-
-
Field Detail
-
DEFAULT
static final NamingStrategy DEFAULT
Constant for the default under score separated lower case strategy.
-
-
Method Detail
-
mappedName
@NonNull java.lang.String mappedName(@NonNull java.lang.String name)Return the mapped name for the given name.- Parameters:
name- The name- Returns:
- The mapped name
-
mappedName
@NonNull default java.lang.String mappedName(@NonNull PersistentEntity entity)Return the mapped name for the given entity.- Parameters:
entity- The entity- Returns:
- The mapped name
-
mappedName
@NonNull default java.lang.String mappedName(Embedded embedded, PersistentProperty property)
Return the mapped name given anEmbeddedassociation and the property of the association. The default strategy takes the parent embedded property name and combines it underscore separated with the child parent property name.For example given:
@Embedded Address address;Where the
Addresstype has a property calledstreetthen a name ofaddress_streetwill be returned- Parameters:
embedded- The embedded parentproperty- The embedded property- Returns:
- The mapped name
-
mappedName
@NonNull default java.lang.String mappedName(@NonNull PersistentProperty property)Return the mapped name for the given property.- Parameters:
property- The property- Returns:
- The mapped name
-
mappedName
@NonNull default java.lang.String mappedName(Association association)
Return the mapped name for the given association.- Parameters:
association- The association- Returns:
- The mapped name
-
mappedName
@NonNull default java.lang.String mappedName(@NonNull java.util.List<Association> associations, @NonNull PersistentProperty property)
-
mappedJoinTableColumn
default java.lang.String mappedJoinTableColumn(PersistentEntity associated, java.util.List<Association> associations, PersistentProperty property)
-
getForeignKeySuffix
@NonNull default java.lang.String getForeignKeySuffix()
The default foreign key suffix for property names.- Returns:
- The suffix
-
-