org.eigenbase.rel.metadata
Class ChainedRelMetadataProvider
java.lang.Object
org.eigenbase.rel.metadata.ChainedRelMetadataProvider
- All Implemented Interfaces:
- RelMetadataProvider
- Direct Known Subclasses:
- DefaultRelMetadataProvider
public class ChainedRelMetadataProvider
- extends Object
- implements RelMetadataProvider
ChainedRelMetadataProvider implements the RelMetadataProvider
interface via the Glossary.ChainOfResponsibilityPattern
.
- Version:
- $Id: //open/dev/farrago/src/org/eigenbase/rel/metadata/ChainedRelMetadataProvider.java#8 $
- Author:
- John V. Sichi
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
providers
private List<RelMetadataProvider> providers
ChainedRelMetadataProvider
public ChainedRelMetadataProvider()
- Creates a new empty chain.
addProvider
public void addProvider(RelMetadataProvider provider)
- Adds a provider, giving it higher priority than all those already in
chain. Chain order matters, since the first provider which answers a
query is used.
- Parameters:
provider
- provider to add
getRelMetadata
public Object getRelMetadata(RelNode rel,
String metadataQueryName,
Object[] args)
- Description copied from interface:
RelMetadataProvider
- Retrieves metadata about a relational expression.
- Specified by:
getRelMetadata
in interface RelMetadataProvider
- Parameters:
rel
- relational expression of interestmetadataQueryName
- name of metadata query to invokeargs
- arguments to metadata query (expected number and type depend
on query name; must have well-defined hashCode/equals for use by
caching); null can be used instead of empty array
- Returns:
- metadata result (actual type depends on query name), or null if
the provider cannot answer the given query/rel combination; it is better
to return null than to return a possibly incorrect answer