## org.eclipse.emf.edit.provider
Class ComposedAdapterFactory

    java.lang.Object
      org.eclipse.emf.edit.provider.ComposedAdapterFactory

All Implemented Interfaces:
  AdapterFactory, ComposeableAdapterFactory, IChangeNotifier, IDisposable

Direct Known Subclasses:
  AdapterFactoryMappingDomain.EditingDomainProvidingComposedAdapterFactory, AdapterFactoryMappingDomain.LabelUpdatePropagatingComposedAdapterFactory

    public class ComposedAdapterFactory

extends java.lang.Object
implements AdapterFactory, ComposeableAdapterFactory, IChangeNotifier, IDisposable

This provides support for composing several factories for different models into a single factory serving the union of the model objects.

Nested Class Summary
`static interface` `ComposedAdapterFactory.Descriptor` A descriptor is can create an adapter factory.

Field Summary
`protected java.util.List<AdapterFactory>` `adapterFactories` This keeps track of all the `AdapterFactory` delegates.
`protected ComposedAdapterFactory.Descriptor.Registry` `adapterFactoryDescriptorRegistry` This is used to demand create adapter factories from a registry.
`protected ChangeNotifier` `changeNotifier` This is used to implement `IChangeNotifier`
`protected ComposedAdapterFactory` `parentAdapterFactory` This is used to implement the `ComposeableAdapterFactory` interface.

Constructor Summary
`ComposedAdapterFactory()`
`ComposedAdapterFactory(AdapterFactory adapterFactory)`
`ComposedAdapterFactory(AdapterFactory[] adapterFactories)`
`ComposedAdapterFactory(java.util.Collection<? extends AdapterFactory> adapterFactories)`
`ComposedAdapterFactory(ComposedAdapterFactory.Descriptor.Registry adapterFactoryDescriptorRegistry)`

Method Summary
`Adapter` `adapt(Notifier target, java.lang.Object type)` Returns either a previously associated adapter or a newly associated adapter, as appropriate.
`protected Adapter` `adapt(Notifier target, java.lang.Object type, boolean isNew)`
`protected Adapter` `adapt(Notifier target, java.lang.Object type, java.util.Collection<java.lang.Object> failedPackages, java.lang.Class<?> javaClass)`
`protected Adapter` `adapt(Notifier target, java.lang.Object type, java.util.Collection<java.lang.Object> failedPackages, java.lang.Class<?> javaClass, boolean isNew)`
`java.lang.Object` `adapt(java.lang.Object target, 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 target)` 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()`.
`void` `addAdapterFactory(AdapterFactory adapterFactory)`
`void` `addListener(INotifyChangedListener notifyChangedListener)` This adds another listener.
`protected AdapterFactory` `delegatedGetFactoryForTypes(java.util.Collection<?> types)`
`void` `dispose()` This is called to dispose the object.
`void` `fireNotifyChanged(Notification notification)` This calls `notifyChanged` for each listener.
`AdapterFactory` `getFactoryForType(java.lang.Object type)`
`AdapterFactory` `getFactoryForTypes(java.util.Collection<?> types)`
`ComposeableAdapterFactory` `getRootAdapterFactory()` This returns the root adapter factory that delegates to this factory.
`void` `insertAdapterFactory(AdapterFactory adapterFactory)`
`boolean` `isFactoryForType(java.lang.Object type)` Returns whether this factory supports adapters for the given type.
`void` `removeAdapterFactory(AdapterFactory adapterFactory)`
`void` `removeListener(INotifyChangedListener notifyChangedListener)` This removes a listener.
`void` `setParentAdapterFactory(ComposedAdapterFactory parentAdapterFactory)` This sets the direct parent adapter factory into which this factory is composed.

Methods inherited from class java.lang.Object
`clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

Field Detail

### adapterFactories

    protected java.util.List<AdapterFactory> adapterFactories

  This keeps track of all the `AdapterFactory` delegates.

### parentAdapterFactory

    protected ComposedAdapterFactory parentAdapterFactory

  This is used to implement the `ComposeableAdapterFactory` interface.

### changeNotifier

    protected ChangeNotifier changeNotifier

  This is used to implement `IChangeNotifier`

### adapterFactoryDescriptorRegistry

    protected ComposedAdapterFactory.Descriptor.Registry adapterFactoryDescriptorRegistry

  This is used to demand create adapter factories from a registry.

Constructor Detail

### ComposedAdapterFactory

    public ComposedAdapterFactory()

### ComposedAdapterFactory

    public ComposedAdapterFactory(ComposedAdapterFactory.Descriptor.Registry adapterFactoryDescriptorRegistry)

### ComposedAdapterFactory

    public ComposedAdapterFactory(AdapterFactory adapterFactory)

### ComposedAdapterFactory

    public ComposedAdapterFactory(AdapterFactory[] adapterFactories)

### ComposedAdapterFactory

    public ComposedAdapterFactory(java.util.Collection<? extends AdapterFactory> adapterFactories)

Method Detail

### isFactoryForType

    public boolean isFactoryForType(java.lang.Object type)

  Description copied from interface: `AdapterFactory`
  Returns whether this factory supports adapters for the given type.

  Specified by:
    `isFactoryForType` in interface `AdapterFactory`
  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)`

### getFactoryForType

    public AdapterFactory getFactoryForType(java.lang.Object type)

### getFactoryForTypes

    public AdapterFactory getFactoryForTypes(java.util.Collection<?> types)

### delegatedGetFactoryForTypes

    protected AdapterFactory delegatedGetFactoryForTypes(java.util.Collection<?> types)

### adapt

    public java.lang.Object adapt(java.lang.Object target,
                                  java.lang.Object type)

  Description copied from interface: `AdapterFactory`
  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.

  Specified by:
    `adapt` in interface `AdapterFactory`
  Parameters:
    `target` - arbitrary object to adapt.
    `type` - the key indicating the type of adapter required.
  Returns:
    either an associated adapter or the object itself.

### adapt

    public Adapter adapt(Notifier target,
                         java.lang.Object type)

  Description copied from interface: `AdapterFactory`
  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.

  Specified by:
    `adapt` in interface `AdapterFactory`
  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)`, `AdapterFactory.adaptNew(org.eclipse.emf.common.notify.Notifier, java.lang.Object)`

### adapt

    protected Adapter adapt(Notifier target,
                            java.lang.Object type,
                            boolean isNew)

### adapt

    protected Adapter adapt(Notifier target,
                            java.lang.Object type,
                            java.util.Collection<java.lang.Object> failedPackages,
                            java.lang.Class<?> javaClass)

### adapt

    protected Adapter adapt(Notifier target,
                            java.lang.Object type,
                            java.util.Collection<java.lang.Object> failedPackages,
                            java.lang.Class<?> javaClass,
                            boolean isNew)

### adaptNew

    public Adapter adaptNew(Notifier target,
                            java.lang.Object type)

  Description copied from interface: `AdapterFactory`
  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.

  Specified by:
    `adaptNew` in interface `AdapterFactory`
  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

    public void adaptAllNew(Notifier target)

  Description copied from interface: `AdapterFactory`
  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.

  Specified by:
    `adaptAllNew` in interface `AdapterFactory`
  Parameters:
    `target` - notifier to adapt.
  See Also:
    `AdapterFactory.adaptNew(org.eclipse.emf.common.notify.Notifier, java.lang.Object)`

### insertAdapterFactory

    public void insertAdapterFactory(AdapterFactory adapterFactory)

### addAdapterFactory

    public void addAdapterFactory(AdapterFactory adapterFactory)

### removeAdapterFactory

    public void removeAdapterFactory(AdapterFactory adapterFactory)

### getRootAdapterFactory

    public ComposeableAdapterFactory getRootAdapterFactory()

  This returns the root adapter factory that delegates to this factory.

  Specified by:
    `getRootAdapterFactory` in interface `ComposeableAdapterFactory`

### setParentAdapterFactory

    public void setParentAdapterFactory(ComposedAdapterFactory parentAdapterFactory)

  This sets the direct parent adapter factory into which this factory is composed.

  Specified by:
    `setParentAdapterFactory` in interface `ComposeableAdapterFactory`

### addListener

    public void addListener(INotifyChangedListener notifyChangedListener)

  Description copied from interface: `IChangeNotifier`
  This adds another listener.

  Specified by:
    `addListener` in interface `IChangeNotifier`

### removeListener

    public void removeListener(INotifyChangedListener notifyChangedListener)

  Description copied from interface: `IChangeNotifier`
  This removes a listener.

  Specified by:
    `removeListener` in interface `IChangeNotifier`

### fireNotifyChanged

    public void fireNotifyChanged(Notification notification)

  Description copied from interface: `IChangeNotifier`
  This calls `notifyChanged` for each listener.

  Specified by:
    `fireNotifyChanged` in interface `IChangeNotifier`

### dispose

    public void dispose()

  Description copied from interface: `IDisposable`
  This is called to dispose the object.

  Specified by:
    `dispose` in interface `IDisposable`

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