'. '


From APIDesign

Jump to: navigation, search

Does any new feature of JDK8 change the way people shall write visitor?

The solution to the expression problem - e.g. to write an extensible visitor - presented at the visitor page (and also Chapter 18 of TheAPIBook) 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.

Personal tools