'. '

Adaptable

From APIDesign

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