Package org.eclipse.core.runtime
Class PlatformObject
- java.lang.Object
-
- org.eclipse.core.runtime.PlatformObject
-
- All Implemented Interfaces:
IAdaptable
- Direct Known Subclasses:
AbstractMemoryRendering,AbstractRepository,AbstractSourceContainer,AbstractSynchronizeParticipant,Breakpoint,BreakpointTypeCategory,CachedResourceVariant,CommonSourceNotFoundEditorInput,CompareEditorInput,DebugElement,FileEditorInput,FileStore,FileSystem,org.eclipse.core.internal.jobs.InternalJob,Launch,LocalFileStorage,ModelProvider,Refactoring,RefactoringDescriptorProxy,RefactoringHistory,RefactoringParticipant,RefactoringProcessor,RepositoryProviderType,ResourceMapping,RuntimeProcess,SynchronizationContext,SynchronizationScopeManager,ZipEntryStorage
public abstract class PlatformObject extends Object implements IAdaptable
An abstract superclass implementing theIAdaptableinterface.getAdapterinvocations 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
IAdaptableinterface and explicitly forwarding thegetAdapterrequest to an implementation of theIAdapterManagerservice. The method would look like:public <T> T getAdapter(Class<T> adapter) { IAdapterManager manager = ...;//lookup the IAdapterManager service return manager.getAdapter(this, adapter); }This class can be used without OSGi running.
Clients may subclass.
- See Also:
IAdapterManager,IAdaptable
-
-
Constructor Summary
Constructors Constructor Description PlatformObject()Constructs a new platform object.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description <T> TgetAdapter(Class<T> adapter)Returns an object which is an instance of the given class associated with this object.
-
-
-
Method Detail
-
getAdapter
public <T> T getAdapter(Class<T> adapter)
Returns an object which is an instance of the given class associated with this object. Returnsnullif no such object can be found.This implementation of the method declared by
IAdaptablepasses the request along to the platform's adapter manager; roughlyPlatform.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:
getAdapterin interfaceIAdaptable- Type Parameters:
T- the class type- Parameters:
adapter- the class to adapt to- Returns:
- the adapted object or
null - See Also:
IAdaptable.getAdapter(Class)
-
-