Record Class DatabaseRelationSymbol
java.lang.Object
java.lang.Record
com.darkcollective.relix.symbol.relation.DatabaseRelationSymbol
- Record Components:
namespace- the namespace this symbol belongs to; must not be blankdeclaredName- the name as written by the user; must not be blankprovenance- built-in or user-defined; must not be nullshadowPolicy- replacement policy for this symbol; must not be nullschema- the structural description of the relation; must not be null
- All Implemented Interfaces:
RelationSymbol,Symbol
public record DatabaseRelationSymbol(String namespace, String declaredName, Provenance provenance, ShadowPolicy shadowPolicy, Schema schema)
extends Record
implements RelationSymbol
A relation symbol backed by an external data store — typically a database table
or view.
Only the Schema is stored here; the actual row data lives in the
external system. This symbol tells semantic analysis what columns the relation
has and what their types are, allowing queries over it to be validated without
executing them.
The convenience factory of(String, Schema) creates a user-owned symbol
in the "default" namespace with ShadowPolicy.PERMITTED:
DatabaseRelationSymbol users = DatabaseRelationSymbol.of("Users",
new Schema(List.of(
new ColumnDefinition("id", ScalarType.NUMBER),
new ColumnDefinition("name", ScalarType.STRING)
)));
-
Constructor Summary
ConstructorsConstructorDescriptionDatabaseRelationSymbol(String namespace, String declaredName, Provenance provenance, ShadowPolicy shadowPolicy, Schema schema) Creates an instance of aDatabaseRelationSymbolrecord class. -
Method Summary
Modifier and TypeMethodDescriptionstatic DatabaseRelationSymbolCreates a built-in database relation in the"builtin"namespace withShadowPolicy.FORBIDDEN.Returns the value of thedeclaredNamerecord component.final booleanIndicates whether some other object is "equal to" this one.final inthashCode()Returns a hash code value for this object.Returns the value of thenamespacerecord component.static DatabaseRelationSymbolCreates a user-defined database relation in the"default"namespace withShadowPolicy.PERMITTED.Returns the value of theprovenancerecord component.schema()Returns the value of theschemarecord component.Returns the value of theshadowPolicyrecord component.final StringtoString()Returns a string representation of this record class.Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, waitMethods inherited from interface com.darkcollective.relix.symbol.Symbol
canonicalName
-
Constructor Details
-
DatabaseRelationSymbol
public DatabaseRelationSymbol(String namespace, String declaredName, Provenance provenance, ShadowPolicy shadowPolicy, Schema schema) Creates an instance of aDatabaseRelationSymbolrecord class.- Parameters:
namespace- the value for thenamespacerecord componentdeclaredName- the value for thedeclaredNamerecord componentprovenance- the value for theprovenancerecord componentshadowPolicy- the value for theshadowPolicyrecord componentschema- the value for theschemarecord component
-
-
Method Details
-
of
Creates a user-defined database relation in the"default"namespace withShadowPolicy.PERMITTED.- Parameters:
name- the relation name; must not be blankschema- the relation's column schema; must not be null- Returns:
- a new
DatabaseRelationSymbol
-
builtin
Creates a built-in database relation in the"builtin"namespace withShadowPolicy.FORBIDDEN.- Parameters:
name- the relation name; must not be blankschema- the relation's column schema; must not be null- Returns:
- a new
DatabaseRelationSymbol
-
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). -
namespace
Returns the value of thenamespacerecord component. -
declaredName
Returns the value of thedeclaredNamerecord component.- Specified by:
declaredNamein interfaceSymbol- Returns:
- the value of the
declaredNamerecord component
-
provenance
Returns the value of theprovenancerecord component.- Specified by:
provenancein interfaceSymbol- Returns:
- the value of the
provenancerecord component
-
shadowPolicy
Returns the value of theshadowPolicyrecord component.- Specified by:
shadowPolicyin interfaceSymbol- Returns:
- the value of the
shadowPolicyrecord component
-
schema
Returns the value of theschemarecord component.- Specified by:
schemain interfaceRelationSymbol- Returns:
- the value of the
schemarecord component
-