KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > eclipse > emf > common > notify > Adapter


1 /**
2  * <copyright>
3  *
4  * Copyright (c) 2002-2004 IBM Corporation and others.
5  * All rights reserved. This program and the accompanying materials
6  * are made available under the terms of the Eclipse Public License v1.0
7  * which accompanies this distribution, and is available at
8  * http://www.eclipse.org/legal/epl-v10.html
9  *
10  * Contributors:
11  * IBM - Initial API and implementation
12  *
13  * </copyright>
14  *
15  * $Id: Adapter.java,v 1.3 2005/06/08 06:19:08 nickb Exp $
16  */

17 package org.eclipse.emf.common.notify;
18
19
20
21 /**
22  * A receiver of notifications.
23  * An adapter is typically associated with a {@link Notifier} via an {@link AdapterFactory}.
24  */

25 public interface Adapter
26 {
27   /**
28    * Notifies that a change to some feature has occurred.
29    * @param notification a description of the change.
30    */

31   void notifyChanged(Notification notification);
32
33   /**
34    * Returns the target from which the adapter receives notification.
35    * In general, an adapter may be shared by more than one notifier.
36    * @return the target notifier.
37    * @see #setTarget
38    */

39   Notifier getTarget();
40
41   /**
42    * Sets the target from which the adapter will receive notification.
43    * This method is only to be called by a notifier when this adapter
44    * is added to or removed from its adapter list.
45    * In general, an adapter may be shared by more than one notifier.
46    * @param newTarget the new notifier.
47    * @see #getTarget
48    */

49   void setTarget(Notifier newTarget);
50
51   /**
52    * Returns whether the adapter is of the given type.
53    * In general, an adapter may be the adapter for many types.
54    * @param type the type.
55    * @return whether the adapter is of the given type.
56    * @see AdapterFactory#isFactoryForType
57    */

58   boolean isAdapterForType(Object JavaDoc type);
59
60   /**
61    * An internal interface implemented by adapters. It allows a shared adapter to be informed when a specific notifier
62    * removes it from its adapter list.
63    */

64   interface Internal extends Adapter
65   {
66     /**
67      * Unsets the target from which the adapter will receive notification. This method is only to be called by a
68      * notifier when this adapter is removed from its adapter list. In general, an adapter may be shared by more
69      * than one notifier, so this mechanism allows the adapter to know specifically which notifier will no longer
70      * be notifying.
71      * @param oldTarget the old notifier.
72      * @see #getTarget
73      * @see #setTarget
74      */

75     void unsetTarget(Notifier oldTarget);
76   }
77 }
78
Popular Tags