public class ComposedAdapterFactory extends java.lang.Object implements AdapterFactory, ComposeableAdapterFactory, IChangeNotifier, IDisposable
| Modifier and Type | Class and Description |
|---|---|
static interface |
ComposedAdapterFactory.Descriptor
A descriptor can create an adapter factory.
|
| Modifier and Type | Field and Description |
|---|---|
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 and Description |
|---|
ComposedAdapterFactory() |
ComposedAdapterFactory(AdapterFactory adapterFactory) |
ComposedAdapterFactory(AdapterFactory[] adapterFactories) |
ComposedAdapterFactory(java.util.Collection<? extends AdapterFactory> adapterFactories) |
ComposedAdapterFactory(ComposedAdapterFactory.Descriptor.Registry adapterFactoryDescriptorRegistry) |
| Modifier and Type | Method and Description |
|---|---|
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.
|
protected java.util.List<AdapterFactory> adapterFactories
AdapterFactory delegates.protected ComposedAdapterFactory parentAdapterFactory
ComposeableAdapterFactory interface.protected ChangeNotifier changeNotifier
IChangeNotifierprotected ComposedAdapterFactory.Descriptor.Registry adapterFactoryDescriptorRegistry
public ComposedAdapterFactory()
public ComposedAdapterFactory(ComposedAdapterFactory.Descriptor.Registry adapterFactoryDescriptorRegistry)
public ComposedAdapterFactory(AdapterFactory adapterFactory)
public ComposedAdapterFactory(AdapterFactory[] adapterFactories)
public ComposedAdapterFactory(java.util.Collection<? extends AdapterFactory> adapterFactories)
public boolean isFactoryForType(java.lang.Object type)
AdapterFactoryisFactoryForType in interface AdapterFactorytype - the key indicating the type of adapter in question.Adapter.isAdapterForType(java.lang.Object)public AdapterFactory getFactoryForType(java.lang.Object type)
public AdapterFactory getFactoryForTypes(java.util.Collection<?> types)
protected AdapterFactory delegatedGetFactoryForTypes(java.util.Collection<?> types)
public java.lang.Object adapt(java.lang.Object target,
java.lang.Object type)
AdapterFactorynull will typically be returned.adapt in interface AdapterFactorytarget - arbitrary object to adapt.type - the key indicating the type of adapter required.null if the type isn't supported or the object cannot be adapted to it.public Adapter adapt(Notifier target, java.lang.Object type)
AdapterFactorycreate a new adapter if possible.adapt in interface AdapterFactorytarget - the notifier to adapt.type - the key indicating the type of adapter required.null otherwise.Adapter.setTarget(org.eclipse.emf.common.notify.Notifier),
AdapterFactory.adaptNew(org.eclipse.emf.common.notify.Notifier, java.lang.Object)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)
public Adapter adaptNew(Notifier target, java.lang.Object type)
AdapterFactorysetTarget on the adapter,
and it may optionally add the adapter to the target.eAdapters().
This is typically not called directly by clients.adaptNew in interface AdapterFactorytarget - the notifier to adapt.type - the key indicating the type of adapter required.null otherwise.Adapter.setTarget(org.eclipse.emf.common.notify.Notifier),
Notifier.eAdapters()public void adaptAllNew(Notifier target)
AdapterFactoryadaptAllNew in interface AdapterFactorytarget - notifier to adapt.AdapterFactory.adaptNew(org.eclipse.emf.common.notify.Notifier, java.lang.Object)public void insertAdapterFactory(AdapterFactory adapterFactory)
public void addAdapterFactory(AdapterFactory adapterFactory)
public void removeAdapterFactory(AdapterFactory adapterFactory)
public ComposeableAdapterFactory getRootAdapterFactory()
getRootAdapterFactory in interface ComposeableAdapterFactorypublic void setParentAdapterFactory(ComposedAdapterFactory parentAdapterFactory)
setParentAdapterFactory in interface ComposeableAdapterFactorypublic void addListener(INotifyChangedListener notifyChangedListener)
IChangeNotifieraddListener in interface IChangeNotifierpublic void removeListener(INotifyChangedListener notifyChangedListener)
IChangeNotifierremoveListener in interface IChangeNotifierpublic void fireNotifyChanged(Notification notification)
IChangeNotifiernotifyChanged for each listener.fireNotifyChanged in interface IChangeNotifierpublic void dispose()
IDisposabledispose in interface IDisposable