Class VendorNameMatcher
Object
gudusoft.gsqlparser.resolver2.matcher.VendorNameMatcher
- All Implemented Interfaces:
INameMatcher
Vendor-specific name matcher using IdentifierService.
This implementation provides database vendor-specific identifier normalization
and comparison by delegating to IdentifierService.
Key features:
- Vendor-specific case folding (Oracle: UPPER, PostgreSQL: LOWER, etc.)
- Proper handling of quoted vs unquoted identifiers
- Support for different object types (tables, columns, schemas)
- High-performance static caching via IdentifierService
Usage example:
// Create matcher for Oracle
VendorNameMatcher matcher = new VendorNameMatcher(EDbVendor.dbvoracle);
// Normalize column name
String normalized = matcher.normalize("\"Column1\""); // Returns "Column1" (quoted preserved)
String normalized2 = matcher.normalize("column1"); // Returns "COLUMN1" (unquoted folded)
// Compare names
boolean match = matcher.matches("COL1", "col1"); // Returns true (both normalize to COL1)
- Since:
- 3.1.0.9
- See Also:
-
Constructor Summary
ConstructorsConstructorDescriptionVendorNameMatcher(EDbVendor vendor) Create a vendor name matcher with default object type (column).VendorNameMatcher(EDbVendor vendor, ESQLDataObjectType defaultObjectType) Create a vendor name matcher with specified default object type. -
Method Summary
Modifier and TypeMethodDescriptionGet the default object type.Get the database vendor.booleanCheck if the matcher is case-sensitivebooleanCheck if two names match according to the matching rules.booleanmatches(String name1, String name2, ESQLDataObjectType objectType) Check if two names match according to vendor rules for a specific object type.booleanmatchesPattern(String name, String pattern) Check if a name is a valid match for a pattern.Normalize a name according to matching rules.normalize(String name, ESQLDataObjectType objectType) Normalize a name according to vendor rules for a specific object type.normalizeQualifiedName(String qualifiedName, ESQLDataObjectType objectType) Normalize a qualified name (e.g., schema.table.column).toString()withObjectType(ESQLDataObjectType objectType) Create a new matcher with a different default object type.
-
Constructor Details
-
VendorNameMatcher
Create a vendor name matcher with default object type (column).- Parameters:
vendor- the database vendor
-
VendorNameMatcher
Create a vendor name matcher with specified default object type.- Parameters:
vendor- the database vendordefaultObjectType- the default object type for normalization/comparison
-
-
Method Details
-
matches
Description copied from interface:INameMatcherCheck if two names match according to the matching rules.- Specified by:
matchesin interfaceINameMatcher- Parameters:
name1- First namename2- Second name- Returns:
- true if names match
-
matches
Check if two names match according to vendor rules for a specific object type.- Parameters:
name1- first namename2- second nameobjectType- the object type (table, column, etc.)- Returns:
- true if names match according to vendor rules
-
matchesPattern
Description copied from interface:INameMatcherCheck if a name is a valid match for a pattern. Used for prefix matching, wildcard matching, etc.- Specified by:
matchesPatternin interfaceINameMatcher- Parameters:
name- The name to testpattern- The pattern to match against- Returns:
- true if name matches pattern
-
normalize
Description copied from interface:INameMatcherNormalize a name according to matching rules. E.g., convert to uppercase for Oracle, lowercase for PostgreSQL unquoted.- Specified by:
normalizein interfaceINameMatcher- Parameters:
name- Name to normalize- Returns:
- Normalized name
-
normalize
Normalize a name according to vendor rules for a specific object type.- Parameters:
name- the name to normalizeobjectType- the object type (table, column, etc.)- Returns:
- normalized name
-
normalizeQualifiedName
Normalize a qualified name (e.g., schema.table.column).This method properly normalizes each part of a multi-part identifier according to vendor rules.
- Parameters:
qualifiedName- the qualified nameobjectType- the final object type- Returns:
- normalized qualified name
-
isCaseSensitive
Description copied from interface:INameMatcherCheck if the matcher is case-sensitive- Specified by:
isCaseSensitivein interfaceINameMatcher
-
getVendor
Get the database vendor.- Returns:
- the vendor
-
getDefaultObjectType
Get the default object type.- Returns:
- the default object type
-
withObjectType
Create a new matcher with a different default object type.- Parameters:
objectType- the new default object type- Returns:
- new VendorNameMatcher instance
-
toString
-