Mhh, that pattern misses half of what the Visitor pattern is about, it seems to me: adding an operation to a class *hierarchy*.
Consequently, when I use the Visitor pattern, it typically has more than one visit method - one for every subtype. Using generics won't work any longer in those cases, as far as I can see.
So I'd say that the article talks about a kind of a degenerated Visitor - perhaps it would be better to call it a Strategy?
Generics are also useful for Visitors, though:
Quite often I use Visitors to decouple domain classes from the view. For example, let's say that we want to show different subclasses in a hierarchy as different icons in a view. Selecting the icons could be done using a Visitor - but as a Visitor typically can't return something, the question is where to remember the icon. You need to use some kind of workaround - my preferred way is using local classes:
I haven't tried it yet (not using
Java 5 at work yet), but using generics, the following should work:
(I hope I got the syntax right...)