![]() |
|
Contents |
Classes can implement this interface (a single method) to provide interfaces that are not API -- each interface type has to be handled in the implementation of getAdapter(Class). This is a good way to extend the class without breaking existing API.
In addition, classes can be augmented by interfaces that are defined by other classes (which requires the getAdapter(Class) to be implemented by a factory.
Public Member Functions | |
| Object | getAdapter (Class adapter) |
| Answers the adapter corresponding to the given class. | |
| Object getAdapter | ( | Class | adapter | ) |
Answers the adapter corresponding to the given class.
The adapter is typically obtained using the class literal, like this:
...
IAdaptable = (IAdaptable) foo;
IMyInterface bar = (IMyInterface)foo.getAdapter(IMyInterface.class);
bar.doMyThing();
...
| adapter | the type of adapter requested |
Implemented in OSComponent.