public final class CatalogObjectKey extends Object
QualifiedCanonKey inferred each component's role from how many components the
name had. That is a guess, and it is wrong in both directions: it read BigQuery
customer.name as table.column when the repository's own FieldPath and
TestBigQueryNestedColumns say it is base column plus STRUCT field — and BigQuery folds
table names case-sensitively while folding column names case-insensitively, so the guess changed
the ANSWER, not merely the label. It also had no server level at all, so SQL Server's
srv.db.dbo.t had its server compared as a catalog.
Here nothing is inferred. Each component carries its role; each OBJECT component carries its
entity kind; the sequence is validated by CatalogNameGrammar at construction; and the
comparison rules for each component come from the one mapping that owns them
(IdentifierRolePolicy for role-decided components,
CatalogIdentifierPolicy.comparisonTypeOfKind(gudusoft.gsqlparser.catalog.runtime.CatalogObjectKind) for objects).
CanonKey — plus an equal database link. So a table
named x never equals a view named x, and db.s.t never equals a name whose
first component is a server.
CanonKeys, whose collation payloads are stable only within one JVM and
collator configuration. Do NOT stringify it to produce a CatalogObjectId: that type
promises cross-snapshot stability, which this cannot give. Use PersistentIdentifierKey
for anything persisted, and never CanonKey.getCanonText() or this type's
toString().| Modifier and Type | Class and Description |
|---|---|
static class |
CatalogObjectKey.Component
One component: its role, its entity kind when it is an object, and its canonical key.
|
| Modifier and Type | Method and Description |
|---|---|
static CatalogObjectKey |
atDatabaseLink(IdentifierService service,
CatalogObjectKey completeLocalKey,
String link,
IdentifierInputForm form)
The same identity, reached through a database link.
|
static CatalogObjectKey |
catalog(IdentifierService service,
CatalogHierarchy hierarchy,
String server,
String catalog,
IdentifierInputForm form)
A catalog, optionally under a server.
|
static CatalogObjectKey |
childObject(IdentifierService service,
CatalogObjectKey parent,
CatalogObjectKind childKind,
String localName,
IdentifierInputForm form)
An index, constraint or package member of an already-identified parent object.
|
static CatalogObjectKey |
column(IdentifierService service,
CatalogObjectKey parentRelation,
String localName,
IdentifierInputForm form)
A column of an already-identified relation.
|
String |
describeRuleDomain()
A description of the rule domain this identity's components were canonicalized under, for
diagnostics.
|
boolean |
equals(Object o) |
List<CatalogObjectKey.Component> |
getComponents()
The components, outermost first.
|
CanonKey |
getDatabaseLink()
The database link qualifying this name, or null.
|
CatalogHierarchy |
getHierarchy()
The namespace topology this identity was declared complete against.
|
CatalogObjectKey.Component |
getLeaf()
The innermost component — the object or column this key names.
|
CatalogObjectKind |
getTerminalKind()
What the name as a whole denotes.
|
int |
hashCode() |
static CatalogObjectKey |
objectInCatalogOnly(IdentifierService service,
CatalogObjectKey parentCatalog,
CatalogObjectKind kind,
String localName,
IdentifierInputForm form)
An object directly inside a catalog, for a schemaless topology such as MySQL's.
|
static CatalogObjectKey |
objectInSchema(IdentifierService service,
CatalogObjectKey parentSchema,
CatalogObjectKind kind,
String localName,
IdentifierInputForm form)
An object inside an already-identified schema.
|
static CatalogObjectKey |
rootObject(IdentifierService service,
CatalogHierarchy hierarchy,
CatalogObjectKind kind,
String localName,
IdentifierInputForm form)
An object at the root of a topology with no container levels at all.
|
static CatalogObjectKey |
rootSchema(IdentifierService service,
CatalogHierarchy hierarchy,
String schema,
IdentifierInputForm form)
A schema under a topology that has no catalog level.
|
static CatalogObjectKey |
schemaIn(IdentifierService service,
CatalogObjectKey parentCatalog,
String schema,
IdentifierInputForm form)
A schema inside an already-identified catalog.
|
int |
size() |
String |
toString() |
public static CatalogObjectKey catalog(IdentifierService service, CatalogHierarchy hierarchy, String server, String catalog, IdentifierInputForm form)
A catalog needs nothing above it: a name without a server means the local server, which is an absence rather than a missing level.
public static CatalogObjectKey schemaIn(IdentifierService service, CatalogObjectKey parentCatalog, String schema, IdentifierInputForm form)
rootSchema(gudusoft.gsqlparser.sqlenv.IdentifierService, gudusoft.gsqlparser.catalog.runtime.CatalogHierarchy, java.lang.String, gudusoft.gsqlparser.sqlenv.IdentifierInputForm) for a topology that genuinely has no catalog.public static CatalogObjectKey rootSchema(IdentifierService service, CatalogHierarchy hierarchy, String schema, IdentifierInputForm form)
public static CatalogObjectKey objectInSchema(IdentifierService service, CatalogObjectKey parentSchema, CatalogObjectKind kind, String localName, IdentifierInputForm form)
public static CatalogObjectKey objectInCatalogOnly(IdentifierService service, CatalogObjectKey parentCatalog, CatalogObjectKind kind, String localName, IdentifierInputForm form)
public static CatalogObjectKey rootObject(IdentifierService service, CatalogHierarchy hierarchy, CatalogObjectKind kind, String localName, IdentifierInputForm form)
public static CatalogObjectKey column(IdentifierService service, CatalogObjectKey parentRelation, String localName, IdentifierInputForm form)
public static CatalogObjectKey childObject(IdentifierService service, CatalogObjectKey parent, CatalogObjectKind childKind, String localName, IdentifierInputForm form)
public static CatalogObjectKey atDatabaseLink(IdentifierService service, CatalogObjectKey completeLocalKey, String link, IdentifierInputForm form)
The local key must already be complete, and its terminal must be a shape a remote reference
is known to take. Descendants composed onto the result inherit the link, which is correct: a
column of a remote table is reachable as t@remote.c.
public List<CatalogObjectKey.Component> getComponents()
public CatalogObjectKind getTerminalKind()
public CatalogHierarchy getHierarchy()
public String describeRuleDomain()
CanonKey equality,
and two keys whose components are equal are the same identity regardless of which service
object produced them.public CanonKey getDatabaseLink()
public int size()
public CatalogObjectKey.Component getLeaf()