View Javadoc

1   /***
2    * CacheEvent.java
3    *
4    * This file is part of the creme library.
5    * The creme library intends to ease the development effort of large
6    * applications by providing easy to use support classes.
7    *
8    * Copyright (C) 2002 Denis Bregeon
9    *
10   * This library is free software; you can redistribute it and/or
11   * modify it under the terms of the GNU Lesser General Public
12   * License as published by the Free Software Foundation; either
13   * version 2.1 of the License, or (at your option) any later version.
14   *
15   * This library is distributed in the hope that it will be useful,
16   * but WITHOUT ANY WARRANTY; without even the implied warranty of
17   * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
18   * Lesser General Public License for more details.
19   *
20   * You should have received a copy of the GNU Lesser General Public
21   * License along with this library; if not, write to the Free Software
22   * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
23   *
24   * contact information: dbregeon@sourceforge.net
25   */
26  package org.jcreme.caches;
27  
28  import java.util.EventObject;
29  
30  /***
31   * Instances of this class report modifications in the contents of a cache.
32   * Namely elements added and removed from the cache.
33   * 
34   * @author $Author: dbregeon $
35   * @version $Revision: 1.2 $
36   */
37  public class CacheEvent extends EventObject {
38      static final long serialVersionUID = -5836842452610798387L;
39  	/***
40       * The element subject of the modification in the cache.
41       */
42      private final Object element;
43  
44      /***
45       * Creates new CacheEvent
46       * 
47       * @param source
48       *            the cache that sent the event.
49       * @param element
50       *            the object that provoked the event.
51       */
52      public CacheEvent(Object source, Object element) {
53          super(source);
54          this.element = element;
55      }
56  
57      /***
58       * Enables access to the element that provoked the event.
59       * 
60       * @return the object which status changed in the cache.
61       */
62      public Object getElement() {
63          return this.element;
64      }
65  }