Class FieldColumnSpecBuilderFieldStep

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

public final class FieldColumnSpecBuilderFieldStep extends Object
A builder step for configuring the mapping of a field in a data model to a database column or relationship. This class is part of a fluent API that facilitates the specification of field-to-column mappings, one-to-many relationships, and many-to-many relationships in a structured and readable way.

Responsibilities:

  • Provide a mechanism to transition to the column mapping step.
  • Enable the specification of one-to-many relationships.
  • Enable the specification of many-to-many relationships.

Key Operations:

  • toColumn(String column): Advances the builder to the column mapping step for the current field.
  • oneToMany(Function<OneToManyBuilder, OneToMany> c): Defines a one-to-many relationship for the field using a functional builder.
  • manyToMany(Function<ManyToManyBuilder, ManyToMany> c): Defines a many-to-many relationship for the field using a functional builder.

This class operates in conjunction with other builder steps such as FieldColumnSpecBuilderColumnStep, OneToManyBuilder, and ManyToManyBuilder to fully define the mapping details for a given field.

Instances of this class are immutable and represent transitional steps in the builder process.

  • Method Details

    • toColumn

      public FieldColumnSpecBuilderColumnStep toColumn(String column)
      Proceeds to the column mapping step for the current field in the fluent API builder. This method is used to define the name of the database column associated with the field being configured.
      Parameters:
      column - The name of the database column to which the field should be mapped. Must not be null or empty.
      Returns:
      An instance of FieldColumnSpecBuilderColumnStep, enabling further configuration of the column or finalisation of the field-to-column mapping.
    • oneToMany

      Defines a one-to-many relationship for the current field in the fluent API builder. This method applies the provided function to configure the relationship and transitions to the terminal step of the builder.
      Parameters:
      c - A function that accepts a OneToManyBuilder to configure the one-to-many relationship and returns an instance of OneToMany.
      Returns:
      An instance of FieldColumnSpecBuilderTerminal, representing the terminal step of the builder for further operations or finalisation.
    • manyToMany

      Defines a many-to-many relationship for the current field in the fluent API builder. This method applies the provided function to configure the relationship and transitions to the terminal step of the builder.
      Parameters:
      c - A function that accepts a ManyToManyBuilder to configure the many-to-many relationship and returns an instance of ManyToMany.
      Returns:
      An instance of FieldColumnSpecBuilderTerminal, representing the terminal step of the builder for further operations or finalisation.