FileDocCategorySizeDatePackage
IAdaptable.javaAPI DocAndroid 1.5 API1930Wed May 06 22:41:04 BST 2009org.apache.harmony.luni.platform

IAdaptable

public interface IAdaptable
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.

Fields Summary
Constructors Summary
Methods Summary
public java.lang.ObjectgetAdapter(java.lang.Class adapter)
Returns 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();
...

param
adapter the type of adapter requested
return
the adapter