Adaptable

From APIDesign

Revision as of 05:34, 21 April 2009 by JaroslavTulach (Talk | contribs)
(diff) ←Older revision | Current revision (diff) | Newer revision→ (diff)
Jump to: navigation, search

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.

Personal tools
buy