public abstract class AbstractNamespace extends Object implements INamespace
Enhanced with reference traceability support: multiple syntactically different identifiers that refer to the same semantic column can be tracked and traced back.
| Modifier and Type | Field and Description |
|---|---|
protected Map<String,ColumnSource> |
columnSources
Cached column sources (populated during validation) - keyed by normalized name
|
protected Map<String,ColumnSourceWithReferences> |
columnSourcesWithRefs
Enhanced column sources with reference traceability (keyed by normalized name).
|
protected int |
guessColumnStrategy
Strategy for handling ambiguous columns.
|
protected INameMatcher |
nameMatcher
Name matcher for column name comparisons
|
protected Object |
node
Associated AST node
|
protected boolean |
referenceTraceabilityEnabled
Whether reference traceability is enabled
|
protected boolean |
validated
Whether this namespace has been validated
|
| Modifier | Constructor and Description |
|---|---|
protected |
AbstractNamespace(Object node) |
protected |
AbstractNamespace(Object node,
INameMatcher nameMatcher) |
| Modifier and Type | Method and Description |
|---|---|
protected void |
addColumnSource(String columnName,
ColumnSource source)
Add a column source (backward compatible - no traceability).
|
protected void |
addColumnSource(String columnName,
ColumnSource source,
TObjectName objectName)
Add a column source with reference traceability support.
|
protected abstract void |
doValidate()
Subclasses override this to perform actual validation logic.
|
void |
enableReferenceTraceability()
Enable reference traceability for this namespace.
|
protected void |
ensureValidated()
Ensure this namespace is validated before accessing column info
|
Map<String,ColumnSource> |
getAllColumnSources()
Get all column sources exposed by this namespace.
|
List<TTable> |
getAllFinalTables()
Get all final physical tables this namespace depends on.
|
Collection<ColumnSourceWithReferences> |
getAllUniqueColumns()
Get all unique columns with their references.
|
List<ColumnReference> |
getColumnReferences(String columnName)
Get all column references for a specific column.
|
ColumnSourceWithReferences |
getColumnSourceWithReferences(String columnName)
Get enhanced column source with references for a specific column.
|
int |
getGuessColumnStrategy()
Get the strategy for handling ambiguous columns.
|
INameMatcher |
getNameMatcher()
Get the name matcher used by this namespace.
|
Object |
getNode()
Get the associated AST node (TTable, TSelectSqlStatement, etc.)
|
ColumnLevel |
hasColumn(String columnName)
Check if a column exists in this namespace.
|
boolean |
isReferenceTraceabilityEnabled()
Check if reference traceability is enabled.
|
boolean |
isValidated()
Check if this namespace is validated/resolved.
|
ColumnSource |
resolveColumn(String columnName)
Resolve a column name to its source.
|
void |
setGuessColumnStrategy(int strategy)
Set the strategy for handling ambiguous columns.
|
String |
toString() |
void |
validate()
Validate/resolve this namespace.
|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, waitaddInferredColumn, getDisplayName, getFinalTable, getInferredColumns, getSelectStatement, getSourceTable, getStarColumn, hasStarColumn, resolveColumnPath, supportsDynamicInferenceprotected boolean validated
protected Map<String,ColumnSource> columnSources
protected Map<String,ColumnSourceWithReferences> columnSourcesWithRefs
protected boolean referenceTraceabilityEnabled
protected final INameMatcher nameMatcher
protected int guessColumnStrategy
protected AbstractNamespace(Object node, INameMatcher nameMatcher)
protected AbstractNamespace(Object node)
public void setGuessColumnStrategy(int strategy)
strategy - One of TBaseType.GUESS_COLUMN_STRATEGY_* constants, or -1 to use global defaultpublic int getGuessColumnStrategy()
public Object getNode()
INamespacegetNode in interface INamespacepublic boolean isValidated()
INamespaceisValidated in interface INamespacepublic void validate()
INamespacevalidate in interface INamespaceprotected abstract void doValidate()
public void enableReferenceTraceability()
public boolean isReferenceTraceabilityEnabled()
protected void addColumnSource(String columnName, ColumnSource source, TObjectName objectName)
This method normalizes the column name and either:
columnName - original column name (may include quotes)source - the column sourceobjectName - the original AST node for traceability (may be null)protected void addColumnSource(String columnName, ColumnSource source)
columnName - original column namesource - the column sourcepublic ColumnLevel hasColumn(String columnName)
INamespacehasColumn in interface INamespacecolumnName - Column name to checkpublic ColumnSource resolveColumn(String columnName)
INamespaceresolveColumn in interface INamespacecolumnName - Column name to resolvepublic Map<String,ColumnSource> getAllColumnSources()
INamespacegetAllColumnSources in interface INamespacepublic List<ColumnReference> getColumnReferences(String columnName)
Requires reference traceability to be enabled.
columnName - the column name (normalized or original)public Collection<ColumnSourceWithReferences> getAllUniqueColumns()
Requires reference traceability to be enabled.
public ColumnSourceWithReferences getColumnSourceWithReferences(String columnName)
columnName - the column namepublic List<TTable> getAllFinalTables()
INamespacegetAllFinalTables in interface INamespaceprotected void ensureValidated()
public INameMatcher getNameMatcher()