Record Class ConnectionDeclaration

java.lang.Object
java.lang.Record
com.darkcollective.relix.lang.ast.ConnectionDeclaration
Record Components:
exported - whether the connection is re-exported to importing scripts
name - the connection name; must not be blank
connectorType - the connector type token (lower-cased); must not be blank
properties - the raw configuration key/value pairs; must not be null
location - the source location of the connection keyword
All Implemented Interfaces:
Statement

public record ConnectionDeclaration(boolean exported, String name, String connectorType, Map<String,String> properties, SourceLocation location) extends Record implements Statement
A top-level connection NAME from <type> { … } declaration.

A connection introduces a named, typed set of coordinates; tables are then referenced through it (as NAME.table or via a source … from NAME binding). The declaration itself defines no relation — it registers connection metadata for the analyzer, optimizer, and execution engine.

The connectorType token after from selects the connector: jdbc (or its permanent alias database), mongodb, http, etc. Configuration is a type-agnostic key/value map — each connector reads the keys it understands (url/user/password/dialect for JDBC; uri/database for MongoDB). config() is a convenience view that projects the JDBC keys into a DatabaseConnectionConfig.

  • Constructor Details

    • ConnectionDeclaration

      public ConnectionDeclaration(boolean exported, String name, String connectorType, Map<String,String> properties, SourceLocation location)
      Creates an instance of a ConnectionDeclaration record class.
      Parameters:
      exported - the value for the exported record component
      name - the value for the name record component
      connectorType - the value for the connectorType record component
      properties - the value for the properties record component
      location - the value for the location record component
    • ConnectionDeclaration

      public ConnectionDeclaration(String name, DatabaseConnectionConfig config)
      Convenience constructor for an exported JDBC connection at an unknown location, from a typed DatabaseConnectionConfig. Keeps existing call sites (and tests) working; the connector type is "jdbc".
      Parameters:
      name - the connection name
      config - the JDBC configuration
  • Method Details

    • config

      public DatabaseConnectionConfig config()
      Projects the JDBC-relevant properties into a DatabaseConnectionConfig. Intended for JDBC consumers; throws when there is no url (e.g. on a non-JDBC connection that should never reach a JDBC code path).
      Returns:
      the JDBC view of this connection's properties
    • 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.
    • exported

      public boolean exported()
      Returns the value of the exported record component.
      Returns:
      the value of the exported record component
    • name

      public String name()
      Returns the value of the name record component.
      Returns:
      the value of the name record component
    • connectorType

      public String connectorType()
      Returns the value of the connectorType record component.
      Returns:
      the value of the connectorType record component
    • properties

      public Map<String,String> properties()
      Returns the value of the properties record component.
      Returns:
      the value of the properties record component
    • location

      public SourceLocation location()
      Returns the value of the location record component.
      Specified by:
      location in interface Statement
      Returns:
      the value of the location record component