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 scriptsname- the connection name; must not be blankconnectorType- the connector type token (lower-cased); must not be blankproperties- the raw configuration key/value pairs; must not be nulllocation- the source location of theconnectionkeyword
- 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 Summary
ConstructorsConstructorDescriptionConnectionDeclaration(boolean exported, String name, String connectorType, Map<String, String> properties, SourceLocation location) Creates an instance of aConnectionDeclarationrecord class.ConnectionDeclaration(String name, DatabaseConnectionConfig config) Convenience constructor for an exported JDBC connection at an unknown location, from a typedDatabaseConnectionConfig. -
Method Summary
Modifier and TypeMethodDescriptionconfig()Projects the JDBC-relevant properties into aDatabaseConnectionConfig.Returns the value of theconnectorTyperecord component.final booleanIndicates whether some other object is "equal to" this one.booleanexported()Returns the value of theexportedrecord component.final inthashCode()Returns a hash code value for this object.location()Returns the value of thelocationrecord component.name()Returns the value of thenamerecord component.Returns the value of thepropertiesrecord component.final StringtoString()Returns a string representation of this record class.
-
Constructor Details
-
ConnectionDeclaration
public ConnectionDeclaration(boolean exported, String name, String connectorType, Map<String, String> properties, SourceLocation location) Creates an instance of aConnectionDeclarationrecord class.- Parameters:
exported- the value for theexportedrecord componentname- the value for thenamerecord componentconnectorType- the value for theconnectorTyperecord componentproperties- the value for thepropertiesrecord componentlocation- the value for thelocationrecord component
-
ConnectionDeclaration
Convenience constructor for an exported JDBC connection at an unknown location, from a typedDatabaseConnectionConfig. Keeps existing call sites (and tests) working; the connector type is"jdbc".- Parameters:
name- the connection nameconfig- the JDBC configuration
-
-
Method Details
-
config
Projects the JDBC-relevant properties into aDatabaseConnectionConfig. Intended for JDBC consumers; throws when there is nourl(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
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. Reference components are compared withObjects::equals(Object,Object); primitive components are compared with '=='. -
exported
public boolean exported()Returns the value of theexportedrecord component.- Returns:
- the value of the
exportedrecord component
-
name
Returns the value of thenamerecord component.- Returns:
- the value of the
namerecord component
-
connectorType
Returns the value of theconnectorTyperecord component.- Returns:
- the value of the
connectorTyperecord component
-
properties
Returns the value of thepropertiesrecord component.- Returns:
- the value of the
propertiesrecord component
-
location
Returns the value of thelocationrecord component.
-