Record Class ColumnReference
java.lang.Object
java.lang.Record
com.darkcollective.relix.lang.ast.source.ColumnReference
- Record Components:
sourceColumns- the referencing columns of the declaring source; must not be emptytargetRelation- the referenced relation name; must not be blanktargetColumns- the referenced columns; must not be emptylocation- the source location of the entry's first token
public record ColumnReference(List<String> sourceColumns, String targetRelation, List<String> targetColumns, SourceLocation location)
extends Record
One entry of a
references: block on a database or connection-table
source — a foreign-key style arrow from columns of the declaring
source to columns of another relation:
references: {
customer_id -> Customers.customer_id,
(tenant_id, product_id) -> Product(tenant_id, id)
}
Column lists are positional — the i-th source column equijoins the i-th target column — and a composite foreign key is one reference. Equal list lengths are validated semantically, with a positioned diagnostic, not here.
The FK-arrow form implies an upper multiplicity bound of 1 on the target
endpoint (each referencing row points to at most one referenced row); the
relationship name defaults to the source column list. Use a standalone
relate statement for explicit names, inverse names, or bounds.
-
Constructor Summary
ConstructorsConstructorDescriptionColumnReference(List<String> sourceColumns, String targetRelation, List<String> targetColumns, SourceLocation location) Creates an instance of aColumnReferencerecord class. -
Method Summary
Modifier and TypeMethodDescriptionThe default relationship name for this unnamed edge: the source column list.final booleanIndicates whether some other object is "equal to" this one.final inthashCode()Returns a hash code value for this object.location()Returns the value of thelocationrecord component.Returns the value of thesourceColumnsrecord component.Returns the value of thetargetColumnsrecord component.Returns the value of thetargetRelationrecord component.final StringtoString()Returns a string representation of this record class.
-
Constructor Details
-
ColumnReference
public ColumnReference(List<String> sourceColumns, String targetRelation, List<String> targetColumns, SourceLocation location) Creates an instance of aColumnReferencerecord class.- Parameters:
sourceColumns- the value for thesourceColumnsrecord componenttargetRelation- the value for thetargetRelationrecord componenttargetColumns- the value for thetargetColumnsrecord componentlocation- the value for thelocationrecord component
-
-
Method Details
-
defaultName
The default relationship name for this unnamed edge: the source column list. -
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). -
sourceColumns
Returns the value of thesourceColumnsrecord component.- Returns:
- the value of the
sourceColumnsrecord component
-
targetRelation
Returns the value of thetargetRelationrecord component.- Returns:
- the value of the
targetRelationrecord component
-
targetColumns
Returns the value of thetargetColumnsrecord component.- Returns:
- the value of the
targetColumnsrecord component
-
location
Returns the value of thelocationrecord component.- Returns:
- the value of the
locationrecord component
-