public final class CanonKey extends Object
Two keys compare equal iff they were produced in the same rule domain — vendor,
object group, the whole effective policy (per-group AND per-category rules plus vendor
flags, including the default collation), the effective rule cell of the category and
collator identity — AND their canonical payloads match. The payload is
the IdentifierService.keyForMap(java.lang.String, gudusoft.gsqlparser.sqlenv.ESQLDataObjectType) text for fold-based rules, or the
CollationKey bytes (from the same collator the equality path uses)
for collation-based rules. The comparison rule that selected the payload is
deliberately NOT part of equality: under quoted-case-preserving vendors, unquoted
foo (folded to FOO) and quoted "FOO" (preserved as FOO)
must converge on the same key even though different rules produced them.
In-process only. Collation key bytes are only stable within one
JVM/collator configuration; never persist or exchange CanonKeys. Custom
CollatorProvider subclasses are isolated by class name — two instances of the
same class with different behavior cannot be distinguished.
| Modifier and Type | Method and Description |
|---|---|
String |
describeRuleDomain()
A short description of this key's rule domain, for diagnostics only.
|
boolean |
equals(Object o) |
String |
getCanonText()
Canonical text payload.
|
String |
getCollatorDomainId()
The collation domain this key's payload belongs to, or null when the key FOLDS rather than
collates.
|
IdentifierProfile.ObjectGroup |
getGroup() |
IdentifierRules |
getRuleDomain()
The effective rule cell this key's payload was produced under — the key's
rule domain within the profile (
IdentifierProfile.ruleDomainOf(gudusoft.gsqlparser.sqlenv.ESQLDataObjectType)). |
EDbVendor |
getVendor() |
int |
hashCode() |
boolean |
isCollationBased() |
boolean |
isRuleCompatibleWith(CanonKey other)
Whether these two keys may sit in one composite identity: the same rule policy, and — when
both collate — the same collator.
|
boolean |
sameRulePolicyAs(CanonKey other)
Whether two canonical keys were produced under the same RULE POLICY — vendor and policy
fingerprint (stage S0R).
|
String |
toString() |
public IdentifierProfile.ObjectGroup getGroup()
public String getCanonText()
public boolean isCollationBased()
public boolean sameRulePolicyAs(CanonKey other)
This deliberately says nothing about the collator. Two components of ONE qualified identity legitimately use different object groups, and a profile may fold one group while collating another, so requiring the same mechanism split a valid catalog/schema/table/column identity apart at the column. Policy equality is the part that is always required and is transitive.
public IdentifierRules getRuleDomain()
IdentifierProfile.ruleDomainOf(gudusoft.gsqlparser.sqlenv.ESQLDataObjectType)).
Part of equality since per-category configuration exists: two categories of one
IdentifierProfile.ObjectGroup may now compare differently, so the group alone no
longer says which relation produced the payload. Under a profile that does not split a
group, every category of that group shares this cell and the keys stay interchangeable
exactly as before.
public String getCollatorDomainId()
A composite identity may mix fold-based and collation-based components, but every collation-based component must belong to the SAME collation domain: two different collators produce incomparable payloads.
public boolean isRuleCompatibleWith(CanonKey other)
This relation is NOT transitive. A fold-based key is compatible with a key
collated by A and also with one collated by B, while A and B are not compatible with each
other. So a composite identity must NOT be validated by comparing every component against the
first one; that loop would accept [fold, A, B]. Accumulate the first non-null
getCollatorDomainId() across all components and compare every other against it.
public String describeRuleDomain()