public class VendorNameMatcher extends Object implements INameMatcher
This implementation provides database vendor-specific identifier normalization
and comparison by delegating to IdentifierService.
Key features:
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)
IdentifierService| Constructor and Description |
|---|
VendorNameMatcher(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.
|
| Modifier and Type | Method and Description |
|---|---|
ESQLDataObjectType |
getDefaultObjectType()
Get the default object type.
|
EDbVendor |
getVendor()
Get the database vendor.
|
boolean |
isCaseSensitive()
Check if the matcher is case-sensitive
|
boolean |
matches(String name1,
String name2)
Check if two names match according to the matching rules.
|
boolean |
matches(String name1,
String name2,
ESQLDataObjectType objectType)
Check if two names match according to vendor rules for a specific object type.
|
boolean |
matchesPattern(String name,
String pattern)
Check if a name is a valid match for a pattern.
|
String |
normalize(String name)
Normalize a name according to matching rules.
|
String |
normalize(String name,
ESQLDataObjectType objectType)
Normalize a name according to vendor rules for a specific object type.
|
String |
normalizeQualifiedName(String qualifiedName,
ESQLDataObjectType objectType)
Normalize a qualified name (e.g., schema.table.column).
|
String |
toString() |
VendorNameMatcher |
withObjectType(ESQLDataObjectType objectType)
Create a new matcher with a different default object type.
|
public VendorNameMatcher(EDbVendor vendor)
vendor - the database vendorpublic VendorNameMatcher(EDbVendor vendor, ESQLDataObjectType defaultObjectType)
vendor - the database vendordefaultObjectType - the default object type for normalization/comparisonpublic boolean matches(String name1, String name2)
INameMatchermatches in interface INameMatchername1 - First namename2 - Second namepublic boolean matches(String name1, String name2, ESQLDataObjectType objectType)
name1 - first namename2 - second nameobjectType - the object type (table, column, etc.)public boolean matchesPattern(String name, String pattern)
INameMatchermatchesPattern in interface INameMatchername - The name to testpattern - The pattern to match againstpublic String normalize(String name)
INameMatchernormalize in interface INameMatchername - Name to normalizepublic String normalize(String name, ESQLDataObjectType objectType)
name - the name to normalizeobjectType - the object type (table, column, etc.)public String normalizeQualifiedName(String qualifiedName, ESQLDataObjectType objectType)
This method properly normalizes each part of a multi-part identifier according to vendor rules.
qualifiedName - the qualified nameobjectType - the final object typepublic boolean isCaseSensitive()
INameMatcherisCaseSensitive in interface INameMatcherpublic ESQLDataObjectType getDefaultObjectType()
public VendorNameMatcher withObjectType(ESQLDataObjectType objectType)
objectType - the new default object type