Record Class EndpointSpec

java.lang.Object
java.lang.Record
com.darkcollective.relix.lang.ast.EndpointSpec
Record Components:
relationRef - the referenced relation name (possibly namespace-qualified); must not be blank
columns - the ordered column names at this endpoint; must not be empty
min - the lower multiplicity bound; must not be negative (default 0)
max - the upper multiplicity bound; empty = unbounded (∞)
location - the source location of the endpoint's first token

public record EndpointSpec(String relationRef, List<String> columns, long min, OptionalLong max, SourceLocation location) extends Record
One endpoint of a RelateStatement — a relation reference plus the ordered columns joined at this side, with optional multiplicity bounds.

Syntactic forms:

   Orders.order_id                    // single-column shorthand
   Orders(order_id) [1..50]           // parenthesised, with bounds
   WarehouseSlot(tenant_id, product_id)   // composite key — ONE endpoint
 

The relation reference is purely syntactic at this level; it is resolved against the symbol table during semantic analysis. Omitted bounds default to the unconstrained reading [0..*]: an absent max (empty OptionalLong) means unbounded.

Bound consistency (max ≥ min, max ≥ 1) is deliberately not enforced here — the semantic layer reports violations as positioned diagnostics rather than construction failures.

  • Constructor Details

    • EndpointSpec

      public EndpointSpec(String relationRef, List<String> columns, long min, OptionalLong max, SourceLocation location)
      Creates an instance of a EndpointSpec record class.
      Parameters:
      relationRef - the value for the relationRef record component
      columns - the value for the columns record component
      min - the value for the min record component
      max - the value for the max record component
      location - the value for the location record component
  • Method Details

    • unbounded

      public static EndpointSpec unbounded(String relationRef, List<String> columns, SourceLocation location)
      Creates an endpoint with the default unconstrained bounds [0..*].
    • 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. Reference components are compared with Objects::equals(Object,Object); primitive components are compared with '=='.
      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.
    • relationRef

      public String relationRef()
      Returns the value of the relationRef record component.
      Returns:
      the value of the relationRef record component
    • columns

      public List<String> columns()
      Returns the value of the columns record component.
      Returns:
      the value of the columns record component
    • min

      public long min()
      Returns the value of the min record component.
      Returns:
      the value of the min record component
    • max

      public OptionalLong max()
      Returns the value of the max record component.
      Returns:
      the value of the max record component
    • location

      public SourceLocation location()
      Returns the value of the location record component.
      Returns:
      the value of the location record component