org.eclipse.emf.common.notify.impl
Class AdapterFactoryImpl

java.lang.Object
  extended by org.eclipse.emf.common.notify.impl.AdapterFactoryImpl
All Implemented Interfaces:
AdapterFactory
Direct Known Subclasses:
AbstractGeneratorAdapterFactory, ChangeAdapterFactory, Ecore2EcoreAdapterFactory, Ecore2XMLAdapterFactory, EcoreAdapterFactory, GenModelAdapterFactory, MappingAdapterFactory, MappingRootImpl.MappedObjectStateAdapterFactory, ReflectiveItemProviderAdapterFactory, ResourceItemProviderAdapterFactory, TreeAdapterFactory, XcoreAdapterFactory

public class AdapterFactoryImpl
extends java.lang.Object
implements AdapterFactory

An extensible adapter factory implementation.


Constructor Summary
AdapterFactoryImpl()
          Creates an instance.
 
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 target, java.lang.Object type)
          Returns either the result of calling adapt(Notifier, Object) or the result of calling resolve(Object, Object), depending on whether the target is a notifier.
 void adaptAllNew(Notifier target)
          Creates an adapter by calling createAdapter(Notifier) and associates it by calling associate.
 Adapter adaptNew(Notifier target, java.lang.Object type)
          Creates an adapter by calling createAdapter(Notifier, Object) and associates it by calling associate.
protected  void associate(Adapter adapter, Notifier target)
          Associates an adapter with a notifier by adding it to the target's adapters.
protected  Adapter createAdapter(Notifier target)
          Creates an AdapterImpl.
protected  Adapter createAdapter(Notifier target, java.lang.Object type)
          Creates an adapter by calling createAdapter(Notifier).
 boolean isFactoryForType(java.lang.Object type)
          Returns false.
protected  java.lang.Object resolve(java.lang.Object object, java.lang.Object type)
          Returns the object itself.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

AdapterFactoryImpl

public AdapterFactoryImpl()
Creates an instance.

Method Detail

isFactoryForType

public boolean isFactoryForType(java.lang.Object type)
Returns false.

Specified by:
isFactoryForType in interface AdapterFactory
Parameters:
type - the key indicating the type of adapter in question.
Returns:
false.
See Also:
Adapter.isAdapterForType(java.lang.Object)

adapt

public java.lang.Object adapt(java.lang.Object target,
                              java.lang.Object type)
Returns either the result of calling adapt(Notifier, Object) or the result of calling resolve(Object, Object), depending on whether the target is a notifier.

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.
See Also:
adapt(Notifier,Object), resolve(Object, Object)

resolve

protected java.lang.Object resolve(java.lang.Object object,
                                   java.lang.Object type)
Returns the object itself. This is called by adapt(Object, Object) for objects that aren't notifiers.

Parameters:
object - arbitrary object to adapt.
type - the key indicating the type of adapter required.
Returns:
the object itself.
See Also:
adapt(Object,Object)

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 if possible.

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

adaptNew

public Adapter adaptNew(Notifier target,
                        java.lang.Object type)
Creates an adapter by calling createAdapter(Notifier, Object) and associates it by calling associate.

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:
createAdapter(Notifier, Object), associate(Adapter, Notifier)

adaptAllNew

public void adaptAllNew(Notifier target)
Creates an adapter by calling createAdapter(Notifier) and associates it by calling associate.

Specified by:
adaptAllNew in interface AdapterFactory
Parameters:
target - notifier to adapt.
See Also:
createAdapter(Notifier)

createAdapter

protected Adapter createAdapter(Notifier target,
                                java.lang.Object type)
Creates an adapter by calling createAdapter(Notifier).

Parameters:
target - the notifier to adapt.
type - the key indicating the type of adapter required.
Returns:
a new adapter.
See Also:
createAdapter(Notifier)

createAdapter

protected Adapter createAdapter(Notifier target)
Creates an AdapterImpl.

Parameters:
target - the notifier to adapt.
Returns:
a new adapter.
See Also:
createAdapter(Notifier)

associate

protected void associate(Adapter adapter,
                         Notifier target)
Associates an adapter with a notifier by adding it to the target's adapters.

Parameters:
adapter - the new adapter to associate.
target - the notifier being adapted.

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