com.metamatrix.query.optimizer.xml
Class ReferenceBindingReplacerVisitor

java.lang.Object
  extended by com.metamatrix.query.sql.LanguageVisitor
      extended by com.metamatrix.query.sql.visitor.ExpressionMappingVisitor
          extended by com.metamatrix.query.optimizer.xml.ReferenceBindingReplacerVisitor

public class ReferenceBindingReplacerVisitor
extends ExpressionMappingVisitor

This visitor class will traverse a language object tree, find any Reference objects, and replace them with the corresponding parsed Expression which is the Reference's binding. The List of parsed bindings must contain Expressions, and of course the number and order of the bindings must match up with the number and order of the References that are in the Language Object.

The easiest way to use this visitor is to call the static methods which create the visitor and run it. The public visit() methods should NOT be called directly.


Constructor Summary
ReferenceBindingReplacerVisitor(java.util.List parsedBindingExpressions)
          Construct a new visitor with the default collection type, which is a HashSet.
 
Method Summary
 Expression replaceExpression(Expression element)
           
static void replaceReferences(LanguageObject obj, java.util.List parsedBindingExpressions)
          Helper to quickly get the references from obj in the references collection
 
Methods inherited from class com.metamatrix.query.sql.visitor.ExpressionMappingVisitor
createAliases, getVariableValues, mapExpressions, mapExpressions, setVariableValues, visit, visit, visit, visit, visit, visit, visit, visit, visit, visit, visit, visit, visit, visit, visit, visit, visit, visit, visit, visit, visit, visit, visit
 
Methods inherited from class com.metamatrix.query.sql.LanguageVisitor
setAbort, shouldAbort, visit, visit, visit, visit, visit, visit, visit, visit, visit, visit, visit, visit, visit, visit, visit, visit, visit, visit, visit, visit, visit, visit, visit, visit, visit, visit, visit, visit, visit, visit, visit, visit, visit, visit, visit, visit, visit, visit, visit, visit, visit
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

ReferenceBindingReplacerVisitor

public ReferenceBindingReplacerVisitor(java.util.List parsedBindingExpressions)
Construct a new visitor with the default collection type, which is a HashSet.

Method Detail

replaceExpression

public Expression replaceExpression(Expression element)
Overrides:
replaceExpression in class ExpressionMappingVisitor

replaceReferences

public static final void replaceReferences(LanguageObject obj,
                                           java.util.List parsedBindingExpressions)
Helper to quickly get the references from obj in the references collection

Parameters:
obj - Language object
elements - Collection to collect references in


Copyright © 2009. All Rights Reserved.