Class GroupCollectorVisitor


  • public class GroupCollectorVisitor
    extends LanguageVisitor

    This visitor class will traverse a language object tree and collect all group symbol references it finds. It uses a collection to collect the groups in so different collections will give you different collection properties - for instance, using a Set will remove duplicates.

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

    • Constructor Detail

      • GroupCollectorVisitor

        public GroupCollectorVisitor​(Collection<GroupSymbol> groups)
        Construct a new visitor with the specified collection, which should be non-null.
        Parameters:
        groups - Collection to use for groups
        Throws:
        IllegalArgumentException - If groups is null
    • Method Detail

      • getGroups

        public Collection<GroupSymbol> getGroups()
        Get the groups collected by the visitor. This should best be called after the visitor has been run on the language object tree.
        Returns:
        Collection of GroupSymbol
      • setIgnoreInlineViewGroups

        public void setIgnoreInlineViewGroups​(boolean ignoreInlineViewGroups)
      • visit

        public void visit​(GroupSymbol obj)
        Visit a language object and collect symbols. This method should NOT be called directly.
        Overrides:
        visit in class LanguageVisitor
        Parameters:
        obj - Language object
      • visit

        public void visit​(StoredProcedure obj)
        Visit a language object and collect symbols. This method should NOT be called directly.
        Overrides:
        visit in class LanguageVisitor
        Parameters:
        obj - Language object
      • getGroups

        public static void getGroups​(LanguageObject obj,
                                     Collection<GroupSymbol> groups)
        Helper to quickly get the groups from obj in the groups collection
        Parameters:
        obj - Language object
        groups - Collection to collect groups in
      • getGroups

        public static Collection<GroupSymbol> getGroups​(LanguageObject obj,
                                                        boolean removeDuplicates)
        Helper to quickly get the groups from obj in a collection. The removeDuplicates flag affects whether duplicate groups will be filtered out.
        Parameters:
        obj - Language object
        removeDuplicates - True to remove duplicates
        Returns:
        Collection of GroupSymbol
      • getGroupsIgnoreInlineViewsAndEvaluatableSubqueries

        public static void getGroupsIgnoreInlineViewsAndEvaluatableSubqueries​(LanguageObject obj,
                                                                              Collection<GroupSymbol> groups)
        Helper to quickly get the groups from obj in the groups collection
        Parameters:
        obj - Language object
        groups - Collection to collect groups in
      • getGroupsIgnoreInlineViews

        public static Collection<GroupSymbol> getGroupsIgnoreInlineViews​(LanguageObject obj,
                                                                         boolean removeDuplicates)
        Helper to quickly get the groups from obj in a collection. The removeDuplicates flag affects whether duplicate groups will be filtered out.
        Parameters:
        obj - Language object
        removeDuplicates - True to remove duplicates
        Returns:
        Collection of GroupSymbol