org.teiid.language.visitor
Class CollectorVisitor<T>

java.lang.Object
  extended by org.teiid.language.visitor.CollectorVisitor<T>
All Implemented Interfaces:
LanguageObjectVisitor

public class CollectorVisitor<T>
extends java.lang.Object
implements LanguageObjectVisitor

This visitor can be used to collect all objects of a certain type in a language tree. Each visit method does an instanceof method to check whether the object is of the expected type.


Constructor Summary
CollectorVisitor(java.lang.Class<T> type)
           
 
Method Summary
static java.util.Collection<ColumnReference> collectElements(LanguageObject object)
          This is a utility method for a common use of this visitor, which is to collect all elements in an object tree.
static java.util.Collection<NamedTable> collectGroups(LanguageObject object)
          This is a utility method for a common use of this visitor, which is to collect all groups in an object tree.
static java.util.Set<NamedTable> collectGroupsUsedByElements(LanguageObject object)
          This is a utility method for a common use of this visitor, which is to collect all groups used by all elements in an object tree.
static
<T> java.util.Collection<T>
collectObjects(java.lang.Class<T> type, LanguageObject object)
          This is a utility method to instantiate and run the visitor in conjunction with a HierarchyVisitor to collect all objects of the specified type of the specified tree in the language object tree.
 java.util.Collection<T> getCollectedObjects()
           
 void visit(AggregateFunction obj)
           
 void visit(AndOr obj)
           
 void visit(Argument obj)
           
 void visit(BatchedUpdates obj)
           
 void visit(Call obj)
           
 void visit(ColumnReference obj)
           
 void visit(Comparison obj)
           
 void visit(Delete obj)
           
 void visit(DerivedColumn obj)
           
 void visit(DerivedTable obj)
           
 void visit(Exists obj)
           
 void visit(ExpressionValueSource obj)
           
 void visit(Function obj)
           
 void visit(GroupBy obj)
           
 void visit(In obj)
           
 void visit(Insert obj)
           
 void visit(IsNull obj)
           
 void visit(IteratorValueSource obj)
           
 void visit(Join obj)
           
 void visit(Like obj)
           
 void visit(Limit obj)
           
 void visit(Literal obj)
           
 void visit(NamedTable obj)
           
 void visit(Not obj)
           
 void visit(OrderBy obj)
           
 void visit(ScalarSubquery obj)
           
 void visit(SearchedCase obj)
           
 void visit(SearchedWhenClause obj)
           
 void visit(Select obj)
           
 void visit(SetClause obj)
           
 void visit(SetQuery obj)
           
 void visit(SortSpecification obj)
           
 void visit(SubqueryComparison obj)
           
 void visit(SubqueryIn obj)
           
 void visit(Update obj)
           
 void visit(With obj)
           
 void visit(WithItem obj)
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

CollectorVisitor

public CollectorVisitor(java.lang.Class<T> type)
Method Detail

getCollectedObjects

public java.util.Collection<T> getCollectedObjects()

visit

public void visit(AggregateFunction obj)
Specified by:
visit in interface LanguageObjectVisitor

visit

public void visit(BatchedUpdates obj)
Specified by:
visit in interface LanguageObjectVisitor

visit

public void visit(Comparison obj)
Specified by:
visit in interface LanguageObjectVisitor

visit

public void visit(AndOr obj)
Specified by:
visit in interface LanguageObjectVisitor

visit

public void visit(Delete obj)
Specified by:
visit in interface LanguageObjectVisitor

visit

public void visit(ColumnReference obj)
Specified by:
visit in interface LanguageObjectVisitor

visit

public void visit(Exists obj)
Specified by:
visit in interface LanguageObjectVisitor

visit

public void visit(Function obj)
Specified by:
visit in interface LanguageObjectVisitor

visit

public void visit(NamedTable obj)
Specified by:
visit in interface LanguageObjectVisitor

visit

public void visit(GroupBy obj)
Specified by:
visit in interface LanguageObjectVisitor

visit

public void visit(In obj)
Specified by:
visit in interface LanguageObjectVisitor

visit

public void visit(DerivedTable obj)
Specified by:
visit in interface LanguageObjectVisitor

visit

public void visit(Insert obj)
Specified by:
visit in interface LanguageObjectVisitor

visit

public void visit(ExpressionValueSource obj)
Specified by:
visit in interface LanguageObjectVisitor

visit

public void visit(IsNull obj)
Specified by:
visit in interface LanguageObjectVisitor

visit

public void visit(Join obj)
Specified by:
visit in interface LanguageObjectVisitor

visit

public void visit(Like obj)
Specified by:
visit in interface LanguageObjectVisitor

visit

public void visit(Limit obj)
Specified by:
visit in interface LanguageObjectVisitor

visit

public void visit(Literal obj)
Specified by:
visit in interface LanguageObjectVisitor

visit

public void visit(Not obj)
Specified by:
visit in interface LanguageObjectVisitor

visit

public void visit(OrderBy obj)
Specified by:
visit in interface LanguageObjectVisitor

visit

public void visit(SortSpecification obj)
Specified by:
visit in interface LanguageObjectVisitor

visit

public void visit(Argument obj)
Specified by:
visit in interface LanguageObjectVisitor

visit

public void visit(Call obj)
Specified by:
visit in interface LanguageObjectVisitor

visit

public void visit(Select obj)
Specified by:
visit in interface LanguageObjectVisitor

visit

public void visit(ScalarSubquery obj)
Specified by:
visit in interface LanguageObjectVisitor

visit

public void visit(SearchedCase obj)
Specified by:
visit in interface LanguageObjectVisitor

visit

public void visit(DerivedColumn obj)
Specified by:
visit in interface LanguageObjectVisitor

visit

public void visit(SubqueryComparison obj)
Specified by:
visit in interface LanguageObjectVisitor

visit

public void visit(SubqueryIn obj)
Specified by:
visit in interface LanguageObjectVisitor

visit

public void visit(Update obj)
Specified by:
visit in interface LanguageObjectVisitor

visit

public void visit(SetQuery obj)
Specified by:
visit in interface LanguageObjectVisitor

visit

public void visit(SetClause obj)
Specified by:
visit in interface LanguageObjectVisitor

visit

public void visit(SearchedWhenClause obj)
Specified by:
visit in interface LanguageObjectVisitor

visit

public void visit(IteratorValueSource obj)
Specified by:
visit in interface LanguageObjectVisitor

visit

public void visit(With obj)
Specified by:
visit in interface LanguageObjectVisitor

visit

public void visit(WithItem obj)
Specified by:
visit in interface LanguageObjectVisitor

collectObjects

public static <T> java.util.Collection<T> collectObjects(java.lang.Class<T> type,
                                                         LanguageObject object)
This is a utility method to instantiate and run the visitor in conjunction with a HierarchyVisitor to collect all objects of the specified type of the specified tree in the language object tree.

Parameters:
type - Language object type to look for
object - Root of the language object tree
Returns:
Collection of ILanguageObject of the specified type

collectElements

public static java.util.Collection<ColumnReference> collectElements(LanguageObject object)
This is a utility method for a common use of this visitor, which is to collect all elements in an object tree.

Parameters:
type - Language object type to look for
object - Root of the language object tree
Returns:
Collection of IElement of the specified type

collectGroups

public static java.util.Collection<NamedTable> collectGroups(LanguageObject object)
This is a utility method for a common use of this visitor, which is to collect all groups in an object tree.

Parameters:
type - Language object type to look for
object - Root of the language object tree
Returns:
Collection of IGroup of the specified type

collectGroupsUsedByElements

public static java.util.Set<NamedTable> collectGroupsUsedByElements(LanguageObject object)
This is a utility method for a common use of this visitor, which is to collect all groups used by all elements in an object tree.

Parameters:
type - Language object type to look for
object - Root of the language object tree
Returns:
Set of IGroup


Copyright © 2011. All Rights Reserved.