Ja.NET Standard Edition 5.0

Documentation API Specification

Contents

IAdaptable Interface Reference

Inherited by ISystemComponent, and OSComponent.

List of all members.


Detailed Description

The interface to extensible objects.

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.

Member Function Documentation

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();
    ...
 

Parameters:
adapter the type of adapter requested
Returns:
the adapter

Implemented in OSComponent.