java.lang.Object
java.lang.Record
org.litebridgedb.orm.api.spec.ColumnSpec
- Record Components:
name- Database column namegenerator- Generator used to create a value for this column if not specified during insertsjoinColumn- Field name of the nested DTO to join onmappedTable- In-line mapped table specification
- All Implemented Interfaces:
ColumnMapping
@NullMarked
public record ColumnSpec(String name, @Nullable ColumnValueGenerator generator, @Nullable String joinColumn, @Nullable TableMapping mappedTable)
extends Record
implements ColumnMapping
Specification of a database column, used to map DTO fields to target expressions.
This class is immutable and provides various factory methods to create instances with different configurations.
-
Constructor Summary
ConstructorsConstructorDescriptionColumnSpec(String name) Constructs a newColumnSpecinstance with the specified name.ColumnSpec(String name, @Nullable ColumnValueGenerator generator) Constructs a newColumnSpecinstance with the specified name and value generator.ColumnSpec(String name, @Nullable ColumnValueGenerator generator, @Nullable String joinColumn) Constructs a newColumnSpecinstance with the specified name, value generator, and join column.ColumnSpec(String name, @Nullable ColumnValueGenerator generator, @Nullable String joinColumn, @Nullable TableMapping mappedTable) Creates an instance of aColumnSpecrecord class. -
Method Summary
Modifier and TypeMethodDescriptionfinal booleanIndicates whether some other object is "equal to" this one.@Nullable ColumnValueGeneratorReturns the value of thegeneratorrecord component.final inthashCode()Returns a hash code value for this object.@Nullable StringReturns the value of thejoinColumnrecord component.@Nullable TableMappingReturns the value of themappedTablerecord component.name()Returns the value of thenamerecord component.final StringtoString()Returns a string representation of this record class.
-
Constructor Details
-
ColumnSpec
public ColumnSpec(String name, @Nullable ColumnValueGenerator generator, @Nullable String joinColumn) Constructs a newColumnSpecinstance with the specified name, value generator, and join column.- Parameters:
name- The name of the database column. This parameter is required and must not be null or empty, as it represents the column's identifier in the database.generator- AColumnValueGeneratorinstance responsible for generating dynamic values for this column during operations like inserts. Can be null if no generator is needed.joinColumn- The name of the join column used when this column maps to a nested or related DTO field. Can be null if no join operation is needed.
-
ColumnSpec
Constructs a newColumnSpecinstance with the specified name and value generator.- Parameters:
name- The name of the database column. This parameter is required and must not be null or empty, as it represents the column's identifier in the database.generator- AColumnValueGeneratorinstance responsible for generating dynamic values for this column during operations like inserts. Can be null if no generator is needed.
-
ColumnSpec
Constructs a newColumnSpecinstance with the specified name.- Parameters:
name- The name of the database column. This parameter is required and must not be null or empty, as it represents the column's identifier in the database.
-
ColumnSpec
public ColumnSpec(String name, @Nullable ColumnValueGenerator generator, @Nullable String joinColumn, @Nullable TableMapping mappedTable) Creates an instance of aColumnSpecrecord class.- Parameters:
name- the value for thenamerecord componentgenerator- the value for thegeneratorrecord componentjoinColumn- the value for thejoinColumnrecord componentmappedTable- the value for themappedTablerecord component
-
-
Method Details
-
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. -
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. -
equals
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 withObjects::equals(Object,Object). -
name
Returns the value of thenamerecord component.- Returns:
- the value of the
namerecord component
-
generator
Returns the value of thegeneratorrecord component.- Returns:
- the value of the
generatorrecord component
-
joinColumn
Returns the value of thejoinColumnrecord component.- Returns:
- the value of the
joinColumnrecord component
-
mappedTable
Returns the value of themappedTablerecord component.- Returns:
- the value of the
mappedTablerecord component
-