Class DtoTableSpecBuilder

java.lang.Object
org.litebridgedb.orm.api.register.DtoTableSpecBuilder

public class DtoTableSpecBuilder extends Object
Builder class for constructing instances of DtoTableSpec.

This class is part of the fluent API provided by the Litebridge ORM for registering the mapping between a Data Transfer Object (DTO) class and its corresponding database table. It leverages the RegistrationContextTerminal as input to extract the necessary mapping details.

The DtoTableSpecBuilder processes the provided registration context and produces an immutable DtoTableSpec that encapsulates the following:

  • The DTO class being registered.
  • The database table specification (TableSpec), including the table name and field-to-column mappings.
  • A list of optional superinterfaces for the DTO class.
Instances of this class are not reusable once the build() method has been invoked.
  • Constructor Details

    • DtoTableSpecBuilder

      public DtoTableSpecBuilder(RegistrationContextTerminal context)
      Constructs a new instance of DtoTableSpecBuilder using the specified registration context. This constructor initialises the builder with the provided RegistrationContextTerminal, which contains the necessary mapping details such as the target DTO class, database table name, field-to-column mappings, and optional superinterfaces.
      Parameters:
      context - The RegistrationContextTerminal containing the configuration details for registering a data transfer object (DTO) with its corresponding database table in the ORM framework. Must not be null.
  • Method Details

    • build

      public DtoTableSpec build()
      Builds the DtoTableSpec instance encapsulating the DTO class, table specification, and superinterfaces.
      Returns:
      The constructed DtoTableSpec instance.