Class DefaultAliasGenerator

java.lang.Object
org.litebridge.orm.persistence.alias.DefaultAliasGenerator
All Implemented Interfaces:
AliasGenerator

public final class DefaultAliasGenerator extends Object implements AliasGenerator
DefaultAliasGenerator is an implementation of AliasGenerator used for generating unique aliases for tables and columns in a database schema. It maintains internal mappings to ensure alias uniqueness across multiple calls.

This class uses an AliasTransformer to apply specific transformation rules to the base alias strings. The aliases are generated using a combination of base string transformations and integer suffixes for conflicts.

Thread-safety: This class is not thread-safe and should be used in single-threaded contexts unless externally synchronized.

  • Constructor Details

    • DefaultAliasGenerator

      public DefaultAliasGenerator(AliasTransformer aliasTransformer)
      Constructs a DefaultAliasGenerator with the specified AliasTransformer.
      Parameters:
      aliasTransformer - the transformer to use for creating base aliases
  • Method Details

    • aliasTable

      public Table aliasTable(OrmTable ormTable)
      Description copied from interface: AliasGenerator
      Generates an aliased table for the specified ORM table.
      Specified by:
      aliasTable in interface AliasGenerator
      Parameters:
      ormTable - The ORM table.
      Returns:
      The aliased table.
    • aliasColumn

      public Column aliasColumn(Table ormTable, ColumnMetaData columnMetaData)
      Description copied from interface: AliasGenerator
      Generates an aliased column for the specified table and column metadata.
      Specified by:
      aliasColumn in interface AliasGenerator
      Parameters:
      ormTable - The table.
      columnMetaData - The column metadata.
      Returns:
      The aliased column.