PicoContainer
  1. PicoContainer
  2. PICO-235

Base PicoVisitor to allow for easy visiting of only one type of component.

    Details

    • Type: Improvement Improvement
    • Status: Closed Closed
    • Priority: Minor Minor
    • Resolution: Fixed
    • Affects Version/s: 1.2
    • Fix Version/s: 1.2
    • Component/s: PicoContainer (Java)
    • Labels:
      None
    • Testcase included:
      yes
    • Number of attachments :
      1

      Description

      I couldn't find anything similar to this in Pico's code base.

      Modivation: Make a simple PicoVisitor that allows for focusing on only one (or more) types of components.

      Using the included BasePicoVisitor, the following code that collects all Containers in a hierarchy becomes possible:

      //Collect a list of all containers in the pico
      final List allContainers = new ArrayList();
      PicoVisitor testingVisitor = new BasePicoVisitor() {
      public void visitContainer(PicoContainer pico)

      { super.visitContainer(pico); //Calls checkTraversal for us. allContainers.add(pico); }

      };
      testingVisitor.traverse(rootPico);

      HTH!
      -Mike (R)

        Activity

        Jörg Schaible made changes -
        Field Original Value New Value
        Assignee Joerg Schaible [ joehni ]
        Jörg Schaible made changes -
        Environment
        Fix Version/s 1.2 [ 11330 ]
        Hide
        Mauro Talevi added a comment -

        Micheal - path has been applied with BasePicoVisitor renamed to TraversalCheckingVisitor.
        Many thanks!

        Show
        Mauro Talevi added a comment - Micheal - path has been applied with BasePicoVisitor renamed to TraversalCheckingVisitor. Many thanks!
        Mauro Talevi made changes -
        Status Open [ 1 ] Closed [ 6 ]
        Resolution Fixed [ 1 ]

          People

          • Assignee:
            Jörg Schaible
            Reporter:
            Michael Rimov
          • Votes:
            0 Vote for this issue
            Watchers:
            0 Start watching this issue

            Dates

            • Created:
              Updated:
              Resolved: