Record Class MultiTableConfig

java.lang.Object
java.lang.Record
de.calamanari.adl.sql.config.MultiTableConfig
Record Components:
tableConfigs - overlap-free single-table configurations NOT NULL, not empty
All Implemented Interfaces:
de.calamanari.adl.cnv.tps.ArgMetaInfoLookup, DataTableConfig, Serializable

public record MultiTableConfig(List<SingleTableConfig> tableConfigs) extends Record implements DataTableConfig
A MultiTableConfig is composed of SingleTableConfigs to map argNames uniquely to columns of multiple tables.
Author:
Karl Eilebrecht
See Also:
  • Constructor Details

    • MultiTableConfig

      public MultiTableConfig(List<SingleTableConfig> tableConfigs)
      Creates an instance of a MultiTableConfig record class.
      Parameters:
      tableConfigs - the value for the tableConfigs record component
  • Method Details

    • withTable

      public static ConfigBuilderInterfaces.MultiTableStep1 withTable(String tableName)
      Entry point for fluently setting up a table in the the physical data model and along with it the logical data model (mapped argNames)

      This is more for testing convenience. The recommended way is first creating a logical data model with all the argNames and then calling withTable(String, ArgMetaInfoLookup) to setup the table(s) and create a mapping.

      Parameters:
      tableName - physical table name
      Returns:
      builder
    • withTable

      Entry point to start with the given table and fluently set up tables in the the physical data model and along with it the logical data model (mapped argNames)

      This is more for testing convenience. The recommended way is first creating a logical data model with all the argNames and then calling withTable(String, ArgMetaInfoLookup) to setup the table(s) and create a mapping.

      Parameters:
      table - already configured table
      Returns:
      builder
    • withTable

      public static ConfigBuilderInterfaces.MultiTableStep1 withTable(String tableName, de.calamanari.adl.cnv.tps.ArgMetaInfoLookup argMetaInfoLookup)
      Entry point for setting up a table and for mapping it to existing argNames
      Parameters:
      tableName -
      argMetaInfoLookup - (logical data model with all the argNames)
      Returns:
      builder
    • withTable

      public static ConfigBuilderInterfaces.MultiTableAddTableOrExit withTable(SingleTableConfig table, de.calamanari.adl.cnv.tps.ArgMetaInfoLookup argMetaInfoLookup)
      Entry point to start with the given table and fluently set up tables mapped to existing argNames
      Parameters:
      table - first table to add
      argMetaInfoLookup - (logical data model with all the argNames)
      Returns:
      builder
    • contains

      public boolean contains(String argName)
      Specified by:
      contains in interface de.calamanari.adl.cnv.tps.ArgMetaInfoLookup
    • lookupAssignment

      public ArgColumnAssignment lookupAssignment(String argName, de.calamanari.adl.ProcessContext ctx)
      Description copied from interface: DataTableConfig
      Determines the column assignment for the given argName.
      Specified by:
      lookupAssignment in interface DataTableConfig
      Parameters:
      argName -
      ctx -
      Returns:
      the configured ArgColumnAssignment if ArgMetaInfoLookup.contains(String)=true, otherwise throws exception
    • numberOfTables

      public int numberOfTables()
      Description copied from interface: DataTableConfig
      Returns the total number of tables in this configuration
      Specified by:
      numberOfTables in interface DataTableConfig
      Returns:
      number of tables this config is based on, >=1
    • lookupTableMetaInfo

      public TableMetaInfo lookupTableMetaInfo(String argName, de.calamanari.adl.ProcessContext ctx)
      Description copied from interface: DataTableConfig
      Returns the table meta infos for the column that is mapped to the given argName
      Specified by:
      lookupTableMetaInfo in interface DataTableConfig
      Parameters:
      argName -
      ctx -
      Returns:
      meta data
    • allTableMetaInfos

      public List<TableMetaInfo> allTableMetaInfos()
      Description copied from interface: DataTableConfig
      Returns the meta information for all the tables in this configuration.

      Important: Although the order is not defined, best case the order in the list reflects the order of configuration.
      In any case it must be stable and it should be deterministic because this is the order the default implementations of several other methods relies on. If the result is composed from an underlying set, then the list should be sorted before returning to avoid indeterministic behavior like flaky tests or unexplainable variations when generating queries.

      Specified by:
      allTableMetaInfos in interface DataTableConfig
      Returns:
      all configured tables
    • toString

      public final String toString()
      Returns a string representation of this record class. The representation contains the name of the class, followed by the name and value of each of the record components.
      Specified by:
      toString in class Record
      Returns:
      a string representation of this object
    • hashCode

      public final int hashCode()
      Returns a hash code value for this object. The value is derived from the hash code of each of the record components.
      Specified by:
      hashCode in class Record
      Returns:
      a hash code value for this object
    • equals

      public final boolean equals(Object o)
      Indicates whether some other object is "equal to" this one. The objects are equal if the other object is of the same class and if all the record components are equal. All components in this record class are compared with Objects::equals(Object,Object).
      Specified by:
      equals in class Record
      Parameters:
      o - the object with which to compare
      Returns:
      true if this object is the same as the o argument; false otherwise.
    • tableConfigs

      public List<SingleTableConfig> tableConfigs()
      Returns the value of the tableConfigs record component.
      Returns:
      the value of the tableConfigs record component