[ 
http://issues.ops4j.org/browse/QI-264?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13558#action_13558
 ] 

Niclas Hedhman commented on QI-264:
-----------------------------------

Not sure if I fully understand the issue. 

I use a lot of Visitors at work, and come to this use work well;

public interface Visitor<T>
{
    boolean visit( T object );
}

and as long as the returned value is true the loop continues. On top of that I 
sometimes use a similar technique at the caller method;

boolean findAllMembersByName( String name, Visitor<Member> visitor );

and it returns true if all instances were looped, and false if the visitor 
aborted the looping.

> Use exception handling pattern in visitors
> ------------------------------------------
>
>                 Key: QI-264
>                 URL: http://issues.ops4j.org/browse/QI-264
>             Project: Qi4j
>          Issue Type: Improvement
>    Affects Versions: 1.1
>            Reporter: Rickard Öberg
>            Assignee: Rickard Öberg
>             Fix For: 1.2
>
>
> Stanislav suggested that we use an exception handling pattern in our 
> visitors. Basically the visitor interface/method is declared with 
> "ThrowableType extends Exception". If the visitor needs to throw a particular 
> type of exception, like SQLException, then that is specified during 
> instantiation. If not, then RuntimeException can be used. This provides a 
> natural way to "cancel" a visitation.

-- 
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators: 
http://issues.ops4j.org/secure/Administrators.jspa
-
For more information on JIRA, see: http://www.atlassian.com/software/jira

       

_______________________________________________
qi4j-dev mailing list
[email protected]
http://lists.ops4j.org/mailman/listinfo/qi4j-dev

Reply via email to