Record Class InlineRelationSymbol
java.lang.Object
java.lang.Record
com.darkcollective.relix.symbol.relation.InlineRelationSymbol
- 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 nullrows- the inline row data; must not be null (may be empty)
- All Implemented Interfaces:
RelationSymbol,Symbol
public record InlineRelationSymbol(String namespace, String declaredName, Provenance provenance, ShadowPolicy shadowPolicy, Schema schema, List<Map<String,Operand>> rows)
extends Record
implements RelationSymbol
A relation whose rows are declared inline in a
.relix source file,
typically as a Markdown table.
Each row is represented as a Map<String, Operand> where the key is
the column name (case-preserved, matching the schema declaration) and the value
is a typed Operand — either a StringOperand
or a NumberOperand.
Type inference is performed by the loader/parser: a column whose every cell
parses as a numeric literal is assigned
ScalarType.NUMBER; otherwise it is
ScalarType.STRING.
Example (as produced by the parser from a Markdown table):
Schema schema = new Schema(List.of(
new ColumnDefinition("id", ScalarType.NUMBER),
new ColumnDefinition("name", ScalarType.STRING)
));
List<Map<String, Operand>> rows = List.of(
Map.of("id", new NumberOperand("1"), "name", new StringOperand("Alice")),
Map.of("id", new NumberOperand("2"), "name", new StringOperand("Bob"))
);
InlineRelationSymbol users = InlineRelationSymbol.of("Users", schema, rows);
Both the outer row list and each inner map are defensive-copied on construction.
-
Constructor Summary
ConstructorsConstructorDescriptionInlineRelationSymbol(String namespace, String declaredName, Provenance provenance, ShadowPolicy shadowPolicy, Schema schema, List<Map<String, Operand>> rows) Creates an instance of aInlineRelationSymbolrecord class. -
Method Summary
Modifier and TypeMethodDescriptionReturns 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 InlineRelationSymbolCreates a user-defined inline relation in the"default"namespace withShadowPolicy.PERMITTED.Returns the value of theprovenancerecord component.rows()Returns the value of therowsrecord 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
-
InlineRelationSymbol
public InlineRelationSymbol(String namespace, String declaredName, Provenance provenance, ShadowPolicy shadowPolicy, Schema schema, List<Map<String, Operand>> rows) Creates an instance of aInlineRelationSymbolrecord 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 componentrows- the value for therowsrecord component
-
-
Method Details
-
of
Creates a user-defined inline relation in the"default"namespace withShadowPolicy.PERMITTED.- Parameters:
name- the relation name; must not be blankschema- the relation's column schema; must not be nullrows- the inline row data; must not be null- Returns:
- a new
InlineRelationSymbol
-
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
-
rows
Returns the value of therowsrecord component.- Returns:
- the value of the
rowsrecord component
-