PicoContainer
  1. PicoContainer
  2. PICO-298

PicoVisitor's Capability Needs Abort Traversal Return Value

    Details

    • Type: Wish Wish
    • Status: In Progress In Progress
    • Priority: Major Major
    • Resolution: Unresolved
    • Affects Version/s: 2.3
    • Fix Version/s: 3.0
    • Component/s: PicoContainer (Java)
    • Labels:
      None
    • Number of attachments :
      0

      Description

      One weaknesses in the current PicoVisitor design is that it does not allow for aborting the traversal.

      For example, if you wish to traverse only the components in one container, then you should be able to: (pseudocode)

      public OnePicoVisitor implements PicoVisitor {

      private PicoContainer visitingPico;

      public OnePicoVisitor (PIcoContainer target)

      { visitingPico = target; }

      public boolean visitContainer(PicoContainer pico) {
      if (visitingPico.equals(pico))

      { return true; }

      //Stop traversal, we don't want more containers.
      return false;
      }

      public boolean visitCA(CA componentAdapter)

      { //do stuff return true; }

      ///......
      }

      Without this 'continue' flag, you must traverse the entire pico hierarchy whether you want it or not. (With larger container hierarchies this can be time consuming)

      Anyway, since its a significant API change in the visitor behavior I'll have to file this under "Wish", but I still want to get it in there.

        People

        • Assignee:
          Michael Rimov
          Reporter:
          Michael Rimov
        • Votes:
          0 Vote for this issue
          Watchers:
          0 Start watching this issue

          Dates

          • Created:
            Updated: