'. '

Adaptable

From APIDesign

(Difference between revisions)
Jump to: navigation, search

JaroslavTulach (Talk | contribs)
(New page: A pattern to support meta-morphosis of an object into another. In its simplest incarnation it can take form of a single method: <source lang="java"> <T> T reincarnate(Class<T> type); </so...)
Next diff →

Revision as of 05:34, 21 April 2009

A pattern to support meta-morphosis of an object into another. In its simplest incarnation it can take form of a single method:

<T> T reincarnate(Class<T> type);

The method either return instance of the given type, or null if the caller cannot be converted into given object.

More advanced implementation of the same concept can be found in the Lookup library. It supports multiple results, notification of changes, etc.

buy