Package com.darkcollective.relix.symbol
Record Class StructType
java.lang.Object
java.lang.Record
com.darkcollective.relix.symbol.StructType
- Record Components:
fields- the ordered fields; never null, copied defensively
- All Implemented Interfaces:
Type
A nested struct type — an ordered set of named, typed
StructType.Fields.
A struct is how relix represents a nested object (a JSON object, a Mongo
sub-document). Conceptually a Schema is the top-level struct of a row,
so the flat relational model is the special case where every field is a
ScalarType.
Field names are case-preserved but must be unique case-insensitively, and
field(String) looks them up case-insensitively — matching Schema.
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionstatic final recordA single named, typed field of aStructType. -
Constructor Summary
ConstructorsConstructorDescriptionStructType(List<StructType.Field> fields) Creates an instance of aStructTyperecord class. -
Method Summary
Modifier and TypeMethodDescriptioncode()A compact, structurally-recursive type code used in the IR report and in machine-readable (JSON) output.display()A short, human-readable, structurally-recursive description of this type — e.g.final booleanIndicates whether some other object is "equal to" this one.Returns the field namedname, matched case-insensitively.fields()Returns the value of thefieldsrecord component.final inthashCode()Returns a hash code value for this object.final StringtoString()Returns a string representation of this record class.
-
Constructor Details
-
StructType
Creates an instance of aStructTyperecord class.- Parameters:
fields- the value for thefieldsrecord component
-
-
Method Details
-
field
Returns the field namedname, matched case-insensitively.- Parameters:
name- the field name to look up- Returns:
- the matching field, or empty if none
-
display
Description copied from interface:TypeA short, human-readable, structurally-recursive description of this type — e.g."number","struct{id: number, tags: array<string>}","array<number>". -
code
Description copied from interface:TypeA compact, structurally-recursive type code used in the IR report and in machine-readable (JSON) output. Scalars are one letter (Number,String,Boolean,?=any); an array is[elem]and a struct is{field:code,…}— e.g.[N],{id:N,tags:[S]}. -
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). -
fields
Returns the value of thefieldsrecord component.- Returns:
- the value of the
fieldsrecord component
-