|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
public interface IAdaptor
provides a way to transform or "morph" objects of one type to another type. The simplest form of
adaptation is a simple cast, which, of course, could be done without this interface. More interesting uses
of this interface provide a way to capture a subset of properties of the adaptable object or to convertthe an adaptable object to a class
that is similar to the original class of the object but has a different public interface (e.g. the java.io.File
class
and org.eclipse.core.runtime.IPath
interface).
Method Summary | |
---|---|
Object |
adapt(Object o,
Class newType)
adapts the object to the given type. |
Class[] |
getSupportedTypes()
returns the types to which given objects may be adapted by this adaptor. |
Method Detail |
---|
Class[] getSupportedTypes()
adapt
method.
adapt(Object, Class)
Object adapt(Object o, Class newType) throws Exception
getSupportedTypes
.
All attempts should be made to insure that this method is symmetric. That is, if
object o
is of type B
, then:
adapt(adapt(o, A.class), B.class) = o
Also note that both types A
and B
should be returned
by getSupportedTypes
.
o
- - object to be adaptednewType
- - the type to which the object is to be adapted
null
if the
object could not be adapted to the given type
Exception
getSupportedTypes()
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |