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 NamingStrategy
A strategy interface for resolving the mapped name of an entity or property.
Since:
1.0
Author:
graemerocher
  • Field Details

    • DEFAULT

      static final NamingStrategy DEFAULT
      Constant for the default underscore separated lower case strategy.
  • Method Details

    • mappedName

      @NonNull @NonNull String mappedName(@NonNull @NonNull String name)
      Return the mapped name for the given name.
      Parameters:
      name - The name
      Returns:
      The mapped name
    • mappedName

      @NonNull default @NonNull String mappedName(@NonNull @NonNull PersistentEntity entity)
      Return the mapped name for the given entity.
      Parameters:
      entity - The entity
      Returns:
      The mapped name
    • mappedName

      @NonNull default @NonNull String mappedName(Embedded embedded, PersistentProperty property)
      Return the mapped name given an Embedded association 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 Address type has a property called street then a name of address_street will be returned

      Parameters:
      embedded - The embedded parent
      property - The embedded property
      Returns:
      The mapped name
    • mappedName

      @NonNull default @NonNull String mappedName(@NonNull @NonNull PersistentProperty property)
      Return the mapped name for the given property.
      Parameters:
      property - The property
      Returns:
      The mapped name
    • mappedName

      @NonNull default @NonNull String mappedName(Association association)
      Return the mapped name for the given association.
      Parameters:
      association - The association
      Returns:
      The mapped name
    • mappedAssociatedName

      @NonNull default @NonNull String mappedAssociatedName(@NonNull @NonNull String associatedName)
      Convert the associated name to a proper format to be appended to the path.
      Parameters:
      associatedName - The associated name
      Returns:
      the name in a proper format
      Since:
      4.2.0
    • mappedName

      @NonNull default @NonNull String mappedName(@NonNull @NonNull List<Association> associations, @NonNull @NonNull PersistentProperty property)
    • mappedJoinTableColumn

      default String mappedJoinTableColumn(PersistentEntity associated, List<Association> associations, PersistentProperty property)
    • getForeignKeySuffix

      @NonNull default @NonNull String getForeignKeySuffix()
      The default foreign key suffix for property names.
      Returns:
      The suffix