Eclipse Platform
2.0

org.eclipse.core.runtime
Class PlatformObject

java.lang.Object
  |
  +--org.eclipse.core.runtime.PlatformObject
All Implemented Interfaces:
IAdaptable
Direct Known Subclasses:
Breakpoint, Launch, ModelObject

public abstract class PlatformObject
extends Object
implements IAdaptable

An abstract superclass implementing the 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 affect can be achieved simply by implementing the IAdaptable interface and explicitly forwarding the getAdapter request to the platform's adapater manager. The method would look like:

     public Object getAdapter(Class adapter) {
         return Platform.getAdapterManager().getAdapter(this, adapter);
     }
 

Clients may subclass.

See Also:
Platform.getAdapterManager()

Constructor Summary
PlatformObject()
          Constructs a new platform object.
 
Method Summary
 Object getAdapter(Class adapter)
          Returns an object which is an instance of the given class associated with this object.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

PlatformObject

public PlatformObject()
Constructs a new platform object.

Method Detail

getAdapter

public Object getAdapter(Class adapter)
Returns an object which is an instance of the given class associated with this object. Returns 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).

Specified by:
getAdapter in interface IAdaptable
Parameters:
adapter - the adapter class to look up
Returns:
a object castable to the given class, or null if this object does not have an adapter for the given class
See Also:
IAdaptable.getAdapter(java.lang.Class), Platform.getAdapterManager()

Eclipse Platform
2.0

Copyright (c) IBM Corp. and others 2000, 2002. All Rights Reserved.