Visitor18
From APIDesign
(Difference between revisions)
JaroslavTulach (Talk | contribs)
(New page: Does any new feature of JDK8 change the way people shall write visitor"? The solution to the expression problem presented at the visitor page (and also Chapter 18 of ...)
Next diff →
Revision as of 13:13, 2 March 2018
Does any new feature of JDK8 change the way people shall write visitor"?
The solution to the expression problem presented at the visitor page (and also Chapter 18 of TheAPIBoook) is another realization of the general principle to separate ClientAPI from ProviderAPI. Client part of the visitor can be enriched by adding new dispatch methods (into final class) with each new version. The interface part of visitor is immutable, a fixed point, which stays the same for those who implement it. Each version defines its own unique interface (according to the list of expression types it supports). The internals of the API then bridge the dispatch methods to appropriate interface visit methods.