Package org.teiid.language.visitor
Class CollectorVisitor<T>
- java.lang.Object
-
- org.teiid.language.visitor.AbstractLanguageVisitor
-
- org.teiid.language.visitor.HierarchyVisitor
-
- org.teiid.language.visitor.CollectorVisitor<T>
-
- All Implemented Interfaces:
LanguageObjectVisitor
public class CollectorVisitor<T> extends HierarchyVisitor
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
Constructors Constructor Description CollectorVisitor(Class<T> type)
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description static 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 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 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> Collection<T>collectObjects(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.Collection<T>getCollectedObjects()voidvisitNode(LanguageObject obj)Visit the LanguageObject instance to perform the Visitor's operation on that instance.-
Methods inherited from class org.teiid.language.visitor.HierarchyVisitor
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 org.teiid.language.visitor.AbstractLanguageVisitor
visit, visit, visit, visit, visit, visit, visit, visitNodes, visitNodes
-
-
-
-
Field Detail
-
objects
protected Collection<T> objects
-
-
Method Detail
-
visitNode
public void visitNode(LanguageObject obj)
Description copied from class:AbstractLanguageVisitorVisit the LanguageObject instance to perform the Visitor's operation on that instance. This method can also be used by the subclass to visit any LanguageObject instances that the given instance may contain.- Overrides:
visitNodein classAbstractLanguageVisitor- Parameters:
obj- an LanguageObject instance- See Also:
HierarchyVisitor
-
getCollectedObjects
public Collection<T> getCollectedObjects()
-
collectObjects
public static <T> Collection<T> collectObjects(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 forobject- Root of the language object tree- Returns:
- Collection of LanguageObject of the specified type
-
collectElements
public static 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:
object- Root of the language object tree- Returns:
- Collection of IElement of the specified type
-
collectGroups
public static 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:
object- Root of the language object tree- Returns:
- Collection of IGroup of the specified type
-
collectGroupsUsedByElements
public static 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:
object- Root of the language object tree- Returns:
- Set of IGroup
-
-