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

java.lang.Object
  extended by org.eclipse.emf.common.notify.impl.SingletonAdapterImpl
All Implemented Interfaces:
Adapter, Adapter.Internal
Direct Known Subclasses:
AbstractGeneratorAdapter

public class SingletonAdapterImpl
extends java.lang.Object
implements Adapter.Internal

An alternate, extensible adapter implementation that is well suited to adapt for a number of objects (typically all objects of a given type).

Since:
2.2

Nested Class Summary
 
Nested classes/interfaces inherited from interface org.eclipse.emf.common.notify.Adapter
Adapter.Internal
 
Field Summary
protected  java.util.List<Notifier> targets
          The list of all the targets to which this adapter is set.
 
Constructor Summary
SingletonAdapterImpl()
          Creates an instance.
 
Method Summary
 void dispose()
          Removes the adapter from all its targets.
 Notifier getTarget()
          Returns the target from which the adapter receives notification.
 boolean isAdapterForType(java.lang.Object type)
          Returns false
 void notifyChanged(Notification msg)
          Does nothing; clients may override so that it does something.
 void setTarget(Notifier target)
          Sets the target from which the adapter will receive notification.
 void unsetTarget(Notifier target)
          Unsets the target from which the adapter will receive notification.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

targets

protected java.util.List<Notifier> targets
The list of all the targets to which this adapter is set.

Constructor Detail

SingletonAdapterImpl

public SingletonAdapterImpl()
Creates an instance.

Method Detail

isAdapterForType

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

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

notifyChanged

public void notifyChanged(Notification msg)
Does nothing; clients may override so that it does something.

Specified by:
notifyChanged in interface Adapter
Parameters:
msg - a description of the change.

getTarget

public Notifier getTarget()
Description copied from interface: Adapter
Returns the target from which the adapter receives notification. In general, an adapter may be shared by more than one notifier.

Specified by:
getTarget in interface Adapter
Returns:
the target notifier.
See Also:
Adapter.setTarget(org.eclipse.emf.common.notify.Notifier)

setTarget

public void setTarget(Notifier target)
Description copied from interface: Adapter
Sets the target from which the adapter will receive notification. This method is only to be called by a notifier when this adapter is added to or removed from its adapter list. In general, an adapter may be shared by more than one notifier.

Specified by:
setTarget in interface Adapter
Parameters:
target - the new notifier.
See Also:
Adapter.getTarget()

unsetTarget

public void unsetTarget(Notifier target)
Description copied from interface: Adapter.Internal
Unsets the target from which the adapter will receive notification. This method is only to be called by a notifier when this adapter is removed from its adapter list. In general, an adapter may be shared by more than one notifier, so this mechanism allows the adapter to know specifically which notifier will no longer be notifying.

Specified by:
unsetTarget in interface Adapter.Internal
Parameters:
target - the old notifier.
See Also:
Adapter.getTarget(), Adapter.setTarget(Notifier)

dispose

public void dispose()
Removes the adapter from all its targets.


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