001package gudusoft.gsqlparser.nodes.structured; 002 003import gudusoft.gsqlparser.TSourceToken; 004import gudusoft.gsqlparser.common.structured.StructuredColumnPath; 005 006/** 007 * The nested read or write one column name denotes: the token of the column it reads into, and the path below that 008 * column ({@code customer.address.city}, {@code items[*].name}). Produced only by {@link NestedAccessNormalizer}; the 009 * views {@code TObjectName.getFieldPathRead()} and {@code getStructStarPath()} read it. 010 */ 011public final class NestedAccess { 012 013 /** What proved where the column ends and the path begins. */ 014 public enum Evidence { 015 /** TSQLResolver2 read the name as a field of a column ({@code ColumnSource} with a field path). */ 016 RESOLVED, 017 /** BigQuery's reading of a name of three or more parts without an alias ({@code StructFieldHint}). */ 018 HINT, 019 /** The dialect's rule: the parts after a subscript, a SET target after its table, a wildcard after a column. */ 020 VENDOR_RULE 021 } 022 023 private final TSourceToken baseToken; 024 private final StructuredColumnPath path; 025 private final Evidence evidence; 026 027 NestedAccess(TSourceToken baseToken, StructuredColumnPath path, Evidence evidence) { 028 this.baseToken = baseToken; 029 this.path = path; 030 this.evidence = evidence; 031 } 032 033 /** The column token, never a table qualifier: {@code customer} in {@code o.customer.address.city}. */ 034 public TSourceToken getBaseToken() { 035 return baseToken; 036 } 037 038 /** The path read, rooted at the column's name as written; for a wildcard read it ends with a STAR step. */ 039 public StructuredColumnPath getPath() { 040 return path; 041 } 042 043 public Evidence getEvidence() { 044 return evidence; 045 } 046}