KickJava   Java API By Example, From Geeks To Geeks.

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


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: NotificationWrapper.java,v 1.2 2005/06/08 06:19:08 nickb Exp $
16  */

17 package org.eclipse.emf.common.notify;
18
19
20 /**
21  * A notification that wraps another notification.
22  * All the {@link Notification} methods are delegated to the wrapped notification.
23  */

24 public class NotificationWrapper implements Notification
25 {
26   /**
27    * The notification that is being wrapped.
28    */

29   protected Notification notification;
30
31   /**
32    * An optional override value for the notification's notifier.
33    */

34   protected Object JavaDoc notifier;
35
36   /**
37    * Create an instance with the specified notification.
38    */

39   public NotificationWrapper(Notification notification)
40   {
41     this.notification = notification;
42   }
43   
44   /**
45    * Create an instance with the specified notifier and notification.
46    */

47   public NotificationWrapper(Object JavaDoc notifier, Notification notification)
48   {
49     this.notifier = notifier;
50     this.notification = notification;
51   }
52   
53   /**
54    * Returns the local notifier if set; otherwise delegates to the getNotifier method of the notification.
55    * @return the notifier.
56    */

57   public Object JavaDoc getNotifier()
58   {
59     return notifier == null ? notification.getNotifier() : notifier;
60   }
61
62   /**
63    * Delegates to the getEventType method of the notification.
64    * @return the eventType.
65    */

66   public int getEventType()
67   {
68     return notification.getEventType();
69   }
70
71   /**
72    * Delegates to the getFeatureID method of the notification.
73    * @return the featureID.
74    */

75   public int getFeatureID(Class JavaDoc expectedClass)
76   {
77     return notification.getFeatureID(expectedClass);
78   }
79
80   /**
81    * Delegates to the getFeature method of the notification.
82    * @return the feature.
83    */

84   public Object JavaDoc getFeature()
85   {
86     return notification.getFeature();
87   }
88
89   /**
90    * Delegates to the getOldValue method of the notification.
91    * @return the oldValue.
92    */

93   public Object JavaDoc getOldValue()
94   {
95     return notification.getOldValue();
96   }
97
98   /**
99    * Delegates to the getNewValue method of the notification.
100    * @return the newValue.
101    */

102   public Object JavaDoc getNewValue()
103   {
104     return notification.getNewValue();
105   }
106
107   /**
108    * Delegates to the wasSet method of the notification.
109    * @return the wasSet result.
110    */

111   public boolean wasSet()
112   {
113     return notification.wasSet();
114   }
115
116   /**
117    * Delegates to the isTouch method of the notification.
118    * @return the isTouch result.
119    */

120   public boolean isTouch()
121   {
122     return notification.isTouch();
123   }
124
125   /**
126    * Delegates to the isReset method of the notification.
127    * @return the isReset result.
128    */

129   public boolean isReset()
130   {
131     return notification.isReset();
132   }
133
134   /**
135    * Delegates to the getPosition method of the notification.
136    * @return the position.
137    */

138   public int getPosition()
139   {
140     return notification.getPosition();
141   }
142
143   /**
144    * Delegates to the merge method of the notification.
145    * @return the merge result.
146    */

147   public boolean merge(Notification notification)
148   {
149     return notification.merge(notification);
150   }
151
152   /**
153    * Delegates to the getOldBooleanValue method of the notification.
154    * @return the oldBooleanValue.
155    */

156   public boolean getOldBooleanValue()
157   {
158     return notification.getOldBooleanValue();
159   }
160
161   /**
162    * Delegates to the getNewBooleanValue method of the notification.
163    * @return the newBooleanValue.
164    */

165   public boolean getNewBooleanValue()
166   {
167     return notification.getNewBooleanValue();
168   }
169
170   /**
171    * Delegates to the getOldByteValue method of the notification.
172    * @return the oldByteValue.
173    */

174   public byte getOldByteValue()
175   {
176     return notification.getOldByteValue();
177   }
178
179   /**
180    * Delegates to the getNewByteValue method of the notification.
181    * @return the newByteValue.
182    */

183   public byte getNewByteValue()
184   {
185     return notification.getNewByteValue();
186   }
187
188   /**
189    * Delegates to the getOldCharValue method of the notification.
190    * @return the oldCharValue.
191    */

192   public char getOldCharValue()
193   {
194     return notification.getOldCharValue();
195   }
196
197   /**
198    * Delegates to the getNewCharValue method of the notification.
199    * @return the newCharValue.
200    */

201   public char getNewCharValue()
202   {
203     return notification.getNewCharValue();
204   }
205
206   /**
207    * Delegates to the getOldDoubleValue method of the notification.
208    * @return the oldDoubleValue.
209    */

210   public double getOldDoubleValue()
211   {
212     return notification.getOldDoubleValue();
213   }
214
215   /**
216    * Delegates to the getNewDoubleValue method of the notification.
217    * @return the newDoubleValue.
218    */

219   public double getNewDoubleValue()
220   {
221     return notification.getNewDoubleValue();
222   }
223
224   /**
225    * Delegates to the getOldFloatValue method of the notification.
226    * @return the oldFloatValue.
227    */

228   public float getOldFloatValue()
229   {
230     return notification.getOldFloatValue();
231   }
232
233   /**
234    * Delegates to the getNewFloatValue method of the notification.
235    * @return the newFloatValue.
236    */

237   public float getNewFloatValue()
238   {
239     return notification.getNewFloatValue();
240   }
241
242   /**
243    * Delegates to the getOldIntValue method of the notification.
244    * @return the oldIntValue.
245    */

246   public int getOldIntValue()
247   {
248     return notification.getOldIntValue();
249   }
250
251   /**
252    * Delegates to the getNewIntValue method of the notification.
253    * @return the newIntValue.
254    */

255   public int getNewIntValue()
256   {
257     return notification.getNewIntValue();
258   }
259
260   /**
261    * Delegates to the getOldLongValue method of the notification.
262    * @return the oldLongValue.
263    */

264   public long getOldLongValue()
265   {
266     return notification.getOldLongValue();
267   }
268
269   /**
270    * Delegates to the getNewLongValue method of the notification.
271    * @return the newLongValue.
272    */

273   public long getNewLongValue()
274   {
275     return notification.getNewLongValue();
276   }
277
278   /**
279    * Delegates to the getOldShortValue method of the notification.
280    * @return the oldShortValue.
281    */

282   public short getOldShortValue()
283   {
284     return notification.getOldShortValue();
285   }
286
287   /**
288    * Delegates to the getNewShortValue method of the notification.
289    * @return the newShortValue.
290    */

291   public short getNewShortValue()
292   {
293     return notification.getNewShortValue();
294   }
295
296   /**
297    * Delegates to the getOldStringValue method of the notification.
298    * @return the oldStringValue.
299    */

300   public String JavaDoc getOldStringValue()
301   {
302     return notification.getOldStringValue();
303   }
304
305   /**
306    * Delegates to the getNewStringValue method of the notification.
307    * @return the newStringValue.
308    */

309   public String JavaDoc getNewStringValue()
310   {
311     return notification.getNewStringValue();
312   }
313 }
314
Popular Tags