1 /*
2 * $Id: IAdaptable.java,v 1.2 2007/05/24 12:26:17 oeuillot Exp $
3 */
4 package org.rcfaces.core.lang;
5
6 /**
7 * An interface for an adaptable object.
8 *
9 * Adaptable objects can be dynamically extended to provide different interfaces
10 * (or "adapters"). Adapters are created by adapter factories, which are in turn
11 * managed by type by adapter managers. For example,
12 *
13 * <pre>
14 * IAdaptable a = [some adaptable];
15 * IFoo x = (IFoo)a.getAdapter(IFoo.class);
16 * if (x != null)
17 * [do IFoo things with x]
18 * </pre>
19 *
20 * @author Eclipse team (latest modification by $Author: oeuillot $)
21 * @version $Revision: 1.2 $ $Date: 2007/05/24 12:26:17 $
22 */
23 public interface IAdaptable {
24
25 /**
26 * Returns an object which is an instance of the given class associated with
27 * this object. Returns <code>null</code> if no such object can be found.
28 *
29 * @param adapter
30 * the adapter class to look up
31 * @return a object castable to the given class, or <code>null</code> if
32 * this object does not have an adapter for the given class
33 */
34 Object getAdapter(Class adapter, Object parameter);
35 }