public abstract class PlatformObject extends Object implements IAdaptable
IAdaptable
interface. getAdapter
invocations are directed
to the platform's adapter manager.
Note: In situations where it would be awkward to subclass this
class, the same effect can be achieved simply by implementing
the IAdaptable
interface and explicitly forwarding
the getAdapter
request to an implementation
of the IAdapterManager
service. The method would look like:
public Object getAdapter(Class adapter) { IAdapterManager manager = ...;//lookup the IAdapterManager service return manager.getAdapter(this, adapter); }
This class can be used without OSGi running.
Clients may subclass.
IAdapterManager
,
IAdaptable
Constructor and Description |
---|
PlatformObject()
Constructs a new platform object.
|
Modifier and Type | Method and Description |
---|---|
Object |
getAdapter(Class adapter)
Returns an object which is an instance of the given class
associated with this object.
|
public Object getAdapter(Class adapter)
null
if
no such object can be found.
This implementation of the method declared by IAdaptable
passes the request along to the platform's adapter manager; roughly
Platform.getAdapterManager().getAdapter(this, adapter)
.
Subclasses may override this method (however, if they do so, they
should invoke the method on their superclass to ensure that the
Platform's adapter manager is consulted).
getAdapter
in interface IAdaptable
adapter
- the class to adapt tonull
IAdaptable.getAdapter(Class)
Copyright (c) 2000, 2014 Eclipse Contributors and others. All rights reserved.Guidelines for using Eclipse APIs.