Class TableSpec

java.lang.Object
org.litebridge.orm.api.spec.TableSpec

@NullMarked public final class TableSpec extends Object
Specification of a database table, used to map DTO instances to target tables.

This class is immutable and provides various factory methods to create instances with different configurations.

  • Constructor Details

    • TableSpec

      public TableSpec(@Nullable String catalog, @Nullable String schema, String table, Map<FieldMapping,ColumnMapping> fieldColumnMap)
      Creates a new TableSpec instance with explicit catalog, schema, and table names.
      Parameters:
      catalog - the database catalog, or null
      schema - the database schema, or null
      table - the table name
      fieldColumnMap - the mapping between DTO fields and database columns
    • TableSpec

      public TableSpec(String name, Map<FieldMapping,ColumnMapping> fieldColumnMap)
      Creates a new TableSpec instance by parsing a qualified or unqualified table name.
      Parameters:
      name - the table name, optionally qualified with catalog and/or schema (e.g. "schema.table")
      fieldColumnMap - the mapping between DTO fields and database columns
  • Method Details

    • name

      public String name()
    • fieldColumnMap

      public Map<FieldMapping,ColumnMapping> fieldColumnMap()
      Field name to ColumnSpec map; key is field name, value is the column definition
      Returns:
      field name-database column mapping
    • toTable

      public Table toTable()