Issue Details (XML | Word | Printable)

Key: PICO-298
Type: Wish Wish
Status: In Progress In Progress
Priority: Major Major
Assignee: Michael Rimov
Reporter: Michael Rimov
Votes: 0
Watchers: 0
Operations

If you were logged in you would be able to see more operations.
PicoContainer

PicoVisitor's Capability Needs Abort Traversal Return Value

Created: 19/Dec/07 08:18 PM   Updated: 23/Jun/08 04:52 PM
Component/s: PicoContainer (Java)
Affects Version/s: 2.3
Fix Version/s: 3.0

Time Tracking:
Not Specified


 Description  « Hide
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.



 All   Comments   Work Log   Change History      Sort Order: Ascending order - Click to sort in descending order
Michael Rimov added a comment - 23/Jun/08 04:52 PM
Partially fixed for 2.4. Will revisit Visitor API for 3.0