Package org.eclipse.core.runtime

# Interface IAdaptable

All Known Subinterfaces:
  `IAggregateWorkingSet`, `IArtifactRepository`, `IBreakpoint`, `IBreakpointTypeCategory`, `IBuildConfiguration`, `ICommonViewerSite`, `ICommonViewerWorkbenchSite`, `IComparableContribution`, `ICompositeRepository<T>`, `IConsolePageParticipant`, `IConsoleView`, `IContainer`, `IDebugElement`, `IDebugTarget`, `IDebugView`, `IEditorInput`, `IEditorPart`, `IEditorSite`, `IEncodedStorage`, `IErrorReportingExpression`, `IExpression`, `IFile`, `IFileArtifactRepository`, `IFileEditorInput`, `IFileState`, `IFileStore`, `IFileSystem`, `IFolder`, `IFormPage`, `IIndexedValue`, `IInPlaceEditor`, `IInPlaceEditorInput`, `IIntroPart`, `IIntroSite`, `ILaunch`, `ILaunchConfiguration`, `ILaunchConfigurationType`, `ILaunchConfigurationWorkingCopy`, `ILineBreakpoint`, `IMarker`, `IMemoryBlock`, `IMemoryBlockExtension`, `IMemoryRendering`, `IMetadataRepository`, `INavigatorContentExtension`, `IPageSite`, `IPathEditorInput`, `IProcess`, `IProject`, `IRegister`, `IRegisterGroup`, `IRepositionableMemoryRendering`, `IRepository<T>`, `IResettableMemoryRendering`, `IResource`, `IResourceDelta`, `IResourceNavigator`, `IReusableEditor`, `ISaveableWorkbenchPart`, `ISearchResultView`, `ISearchResultViewPart`, `ISourceContainer`, `IStackFrame`, `IStorage`, `IStorageEditorInput`, `ISynchronizeParticipant`, `ISynchronizeView`, `ITextEditor`, `IThread`, `ITriggerPoint`, `IURIEditorInput`, `IValue`, `IVariable`, `IViewDescriptor`, `IViewPart`, `IViewSite`, `IWatchExpression`, `IWatchpoint`, `IWizardDescriptor`, `IWorkbench`, `IWorkbenchPart`, `IWorkbenchPart2`, `IWorkbenchPart3`, `IWorkbenchPartSite`, `IWorkbenchSite`, `IWorkingSet`, `IWorkspace`, `IWorkspaceRoot`

All Known Implementing Classes:
  `AbstractArtifactRepository`, `org.eclipse.debug.internal.ui.views.memory.renderings.AbstractBaseTableRendering`, `AbstractDebugView`, `AbstractDecoratedTextEditor`, `AbstractMemoryRendering`, `AbstractMetadataRepository`, `AbstractMultiEditor`, `AbstractRefactoringDescriptorResourceMapping`, `AbstractRefactoringHistoryResourceMapping`, `AbstractRepository`, `AbstractSourceContainer`, `AbstractSynchronizeParticipant`, `AbstractTableRendering`, `AbstractTextEditor`, `AbstractTextEditor.TextEditorSavable`, `AbstractTextRendering`, `AdaptableList`, `ArchiveSourceContainer`, `Breakpoint`, `BreakpointTypeCategory`, `CachedResourceVariant`, `Change`, `CommonNavigator`, `CommonSourceNotFoundEditor`, `CommonSourceNotFoundEditorInput`, `CompareEditorInput`, `CompareViewerPane`, `CompareViewerSwitchingPane`, `CompositeChange`, `CompositeResourceMapping`, `CompositeSourceContainer`, `ContainerSourceContainer`, `ContentOutline`, `CopyParticipant`, `CopyProcessor`, `CopyRefactoring`, `CreateParticipant`, `CustomizableIntroPart`, `DebugElement`, `DefaultRepositoryProviderType`, `DefaultSourceContainer`, `DeleteParticipant`, `DeleteProcessor`, `DeleteRefactoring`, `DeleteResourceChange`, `DirectorySourceContainer`, `DocumentChange`, `DocumentRangeNode`, `DocumentTemplateContext`, `EditorPart`, `org.eclipse.ui.internal.views.markers.ExtendedMarkersView`, `ExternalArchiveSourceContainer`, `FileEditorInput`, `FileInPlaceEditorInput`, `FileStore`, `FileStoreEditorInput`, `FileSystem`, `FileSystemElement`, `FolderSourceContainer`, `FormEditor`, `FormPage`, `HistoryPage`, `HistoryPageCompareEditorInput`, `HistoryPageSaveablePart`, `org.eclipse.core.internal.jobs.InternalJob`, `org.eclipse.core.internal.resources.InternalWorkspaceJob`, `IntroPart`, `Job`, `Launch`, `LineBreakpoint`, `LoadMetadataRepositoryJob`, `LocalFileStorage`, `MarkerSupportView`, `MergeContext`, `ModelProvider`, `ModelSynchronizeParticipant`, `MoveParticipant`, `MoveProcessor`, `MoveRefactoring`, `MoveRenameResourceChange`, `MoveResourceChange`, `MultiEditor`, `MultiEditorInput`, `MultiPageEditor`, `MultiPageEditorPart`, `MultiPageEditorSite`, `MultiStateTextFileChange`, `NullChange`, `OperationHistoryActionHandler`, `PageBookView`, `PageCompareEditorInput`, `PageSaveablePart`, `PageSite`, `ParticipantPageCompareEditorInput`, `ParticipantPageSaveablePart`, `PendingUpdateAdapter`, `PlatformObject`, `ProcessorBasedRefactoring`, `ProfileModificationJob`, `ProjectExplorer`, `ProjectSourceContainer`, `PropertySheet`, `PropertySheetPage`, `ProvisioningJob`, `RedoActionHandler`, `Refactoring`, `RefactoringDescriptorProxy`, `RefactoringHistory`, `RefactoringParticipant`, `RefactoringProcessor`, `RenameParticipant`, `RenameProcessor`, `RenameRefactoring`, `RenameResourceChange`, `RepositoryProvider`, `RepositoryProviderType`, `ResourceChange`, `ResourceMapping`, `ResourceNavigator`, `RuntimeProcess`, `Saveable`, `SaveableCompareEditorInput`, `SaveableComparison`, `SaveablePartAdapter`, `SharedHeaderFormEditor`, `StatusAdapter`, `StatusTextEditor`, `StructureRootNode`, `SubscriberMergeContext`, `SubscriberParticipant`, `SubscriberScopeManager`, `SynchronizationContext`, `SynchronizationScopeManager`, `SyncInfo`, `SyncInfoCompareInput`, `TemplateContext`, `TemplatesView`, `TextChange`, `TextConsolePage`, `TextEditBasedChange`, `TextEditor`, `TextFileChange`, `TextMergeViewer`, `UIJob`, `UndoActionHandler`, `UndoTextFileChange`, `ViewPart`, `WorkbenchJob`, `WorkbenchPart`, `WorkingSetSourceContainer`, `WorkspaceJob`, `WorkspaceSourceContainer`, `ZipEntryStorage`

public interface IAdaptable
An interface for an adaptable object.

Adaptable objects can be dynamically extended to provide different interfaces (or "adapters"). Adapters are created by adapter factories, which are in turn managed by type by adapter managers.

For example,

         IAdaptable a = [some adaptable];
         IFoo x = Adapters.getAdapter(a, IFoo.class, true);
         if (x != null)
             [do IFoo things with x]

This interface can be used without OSGi running.

Clients may implement this interface, or obtain a default implementation of this interface by subclassing `PlatformObject`.

See Also:
  - `IAdapterFactory`
  - `IAdapterManager`
  - `PlatformObject`
  - `Adapters`

## Method Summary

Modifier and Type
Method
Description
`<T> T`
`getAdapter(Class<T> adapter)`
Returns an object which is an instance of the given class associated with this object.

## Method Details

### getAdapter

<T> T getAdapter(Class<T> 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.

Clients may implement this method but should generally call `Adapters.adapt(Object, Class, boolean)` rather than invoking it directly.

Type Parameters:
  `T` - the class type
Parameters:
  `adapter` - the adapter class to look up
Returns:
  a object of the given class, or `null` if this object does not have an adapter for the given class