Package org.eclipse.emf.common.notify
Interface AdapterFactory
- All Known Implementing Classes:
AdapterFactoryImpl
public interface AdapterFactory
A factory for creating adapters and associating them with notifiers.
An implementation may choose to associate one adapter with multiple notifiers.
-
Method Summary
Modifier and TypeMethodDescriptionReturns either an associated adapter for the object, or the object itself, depending on whether the object is a notifier that supports an adapter of the given type.Returns either a previously associated adapter or a newly associated adapter, as appropriate.voidadaptAllNew(Notifier notifier) Creates a new associated adapter of each type of adapter supported by this factory, as necessary.Creates a new associated adapter of the given type; it may optionally callsetTargeton the adapter, and it may optionally add the adapter to thetarget.eAdapters().booleanisFactoryForType(Object type) Returns whether this factory supports adapters for the given type.
-
Method Details
-
isFactoryForType
Returns whether this factory supports adapters for the given type.- Parameters:
type- the key indicating the type of adapter in question.- Returns:
- whether this factory supports adapters for the given type.
- See Also:
-
adapt
Returns either an associated adapter for the object, or the object itself, depending on whether the object is a notifier that supports an adapter of the given type. This is essentially just a convenience method that allows a factory to act as a filter for converting objects to adapters. If the type isn't supported or the specific object can't be adapted to it,nullwill typically be returned.- Parameters:
object- arbitrary object to adapt.type- the key indicating the type of adapter required.- Returns:
- either an associated adapter, the object itself, or
nullif the type isn't supported or the object cannot be adapted to it.
-
adapt
Returns either a previously associated adapter or a newly associated adapter, as appropriate. It will check if the right type of adapter is already associated with the target and will return it in that case; otherwise, it willcreatea new adapter if possible.- Parameters:
target- the notifier to adapt.type- the key indicating the type of adapter required.- Returns:
- a previously existing associated adapter, a new associated adapter if possible, or
nullotherwise. - See Also:
-
adaptNew
Creates a new associated adapter of the given type; it may optionally callsetTargeton the adapter, and it may optionally add the adapter to thetarget.eAdapters(). This is typically not called directly by clients.- Parameters:
target- the notifier to adapt.type- the key indicating the type of adapter required.- Returns:
- a new associated adapter if possible, or
nullotherwise. - See Also:
-
adaptAllNew
Creates a new associated adapter of each type of adapter supported by this factory, as necessary. This is typically used to adapt newly created objects.- Parameters:
notifier- notifier to adapt.- See Also:
-