Package org.eclipse.core.runtime
Interface IAdapterFactory
-
- All Known Implementing Classes:
EObjModelHandler
public interface IAdapterFactoryAn adapter factory defines behavioral extensions for one or more classes that implements theIAdaptableinterface. Adapter factories are registered with an adapter manager.This interface can be used without OSGi running.
Clients may implement this interface.
- See Also:
IAdapterManager,IAdaptable
-
-
Field Summary
Fields Modifier and Type Field Description static StringSERVICE_PROPERTY_ADAPTABLE_CLASSService property to use when registering a factory as OSGi-service to declare the adaptable class type, this is a multi-string-property, if more than one is given the factory will be register multiple timesstatic StringSERVICE_PROPERTY_ADAPTER_NAMESOptional service property to use when registering a factory as OSGi-service to declare the possible adapter types.
-
Method Summary
All Methods Instance Methods Abstract Methods Modifier and Type Method Description <T> TgetAdapter(Object adaptableObject, Class<T> adapterType)Returns an object which is an instance of the given class associated with the given object.Class<?>[]getAdapterList()Returns the collection of adapter types handled by this factory.
-
-
-
Field Detail
-
SERVICE_PROPERTY_ADAPTABLE_CLASS
static final String SERVICE_PROPERTY_ADAPTABLE_CLASS
Service property to use when registering a factory as OSGi-service to declare the adaptable class type, this is a multi-string-property, if more than one is given the factory will be register multiple times- Since:
- 3.14
- See Also:
- Constant Field Values
-
SERVICE_PROPERTY_ADAPTER_NAMES
static final String SERVICE_PROPERTY_ADAPTER_NAMES
Optional service property to use when registering a factory as OSGi-service to declare the possible adapter types. If the property is given, the service is only queried when actually required, this is a multi-string-property.- Since:
- 3.14
- See Also:
- Constant Field Values
-
-
Method Detail
-
getAdapter
<T> T getAdapter(Object adaptableObject, Class<T> adapterType)
Returns an object which is an instance of the given class associated with the given object. Returnsnullif no such object can be found.- Parameters:
adaptableObject- the adaptable object being queried (usually an instance ofIAdaptable)adapterType- the type of adapter to look up- Returns:
- a object of the given adapter type,
or
nullif this adapter factory does not have an adapter of the given type for the given object
-
getAdapterList
Class<?>[] getAdapterList()
Returns the collection of adapter types handled by this factory.This method is generally used by an adapter manager to discover which adapter types are supported, in advance of dispatching any actual
getAdapterrequests.- Returns:
- the collection of adapter types
-
-