org.eclipse.emf.common.notify
Interface AdapterFactory

All Known Subinterfaces:
ComposeableAdapterFactory, GeneratorAdapterFactory
All Known Implementing Classes:
AbstractGeneratorAdapterFactory, AdapterFactoryImpl, AdapterFactoryMappingDomain.EditingDomainProvidingComposedAdapterFactory, AdapterFactoryMappingDomain.LabelUpdatePropagatingComposedAdapterFactory, ChangeAdapterFactory, ChangeItemProviderAdapterFactory, ComposedAdapterFactory, DecoratorAdapterFactory, Ecore2EcoreAdapterFactory, Ecore2EcoreItemProviderAdapterFactory, Ecore2XMLAdapterFactory, Ecore2XMLItemProviderAdapterFactory, EcoreAdapterFactory, EcoreItemProviderAdapterFactory, GenModelAdapterFactory, GenModelGeneratorAdapterFactory, GenModelItemProviderAdapterFactory, MappingAdapterFactory, MappingEditor.MyDecoratorAdapterFactory, MappingEditor.OverviewDecoratorAdapterFactory, MappingItemProviderAdapterFactory, MappingRootImpl.MappedObjectStateAdapterFactory, ReflectiveItemProviderAdapterFactory, ResourceItemProviderAdapterFactory, TreeAdapterFactory, TreeItemProviderAdapterFactory

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
 Adapter adapt(Notifier target, java.lang.Object type)
          Returns either a previously associated adapter or a newly associated adapter, as appropriate.
 java.lang.Object adapt(java.lang.Object object, java.lang.Object type)
          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.
 void adaptAllNew(Notifier notifier)
          Creates a new associated adapter of each type of adapter supported by this factory, as necessary.
 Adapter adaptNew(Notifier target, java.lang.Object type)
          Creates a new associated adapter of the given type; it may optionally call setTarget on the adapter, and it may optionally add the adapter to the target.eAdapters().
 boolean isFactoryForType(java.lang.Object type)
          Returns whether this factory supports adapters for the given type.
 

Method Detail

isFactoryForType

boolean isFactoryForType(java.lang.Object type)
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:
Adapter.isAdapterForType(java.lang.Object)

adapt

java.lang.Object adapt(java.lang.Object object,
                       java.lang.Object type)
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.

Parameters:
object - arbitrary object to adapt.
type - the key indicating the type of adapter required.
Returns:
either an associated adapter or the object itself.

adapt

Adapter adapt(Notifier target,
              java.lang.Object type)
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 will create a new adapter.

Parameters:
target - the notifier to adapt.
type - the key indicating the type of adapter required.
Returns:
an associated adapter.
See Also:
Adapter.setTarget(org.eclipse.emf.common.notify.Notifier), adaptNew(org.eclipse.emf.common.notify.Notifier, java.lang.Object)

adaptNew

Adapter adaptNew(Notifier target,
                 java.lang.Object type)
Creates a new associated adapter of the given type; it may optionally call setTarget on the adapter, and it may optionally add the adapter to the target.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.
See Also:
Adapter.setTarget(org.eclipse.emf.common.notify.Notifier), Notifier.eAdapters()

adaptAllNew

void adaptAllNew(Notifier notifier)
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:
adaptNew(org.eclipse.emf.common.notify.Notifier, java.lang.Object)

Copyright 2001-2006 IBM Corporation and others.
All Rights Reserved.