|
|||||||||||||||||||
Source file | Conditionals | Statements | Methods | TOTAL | |||||||||||||||
CacheEntryEvent.java | - | 87,5% | 83,3% | 85,7% |
|
1 | /* | |
2 | * Copyright (c) 2002-2003 by OpenSymphony | |
3 | * All rights reserved. | |
4 | */ | |
5 | package com.opensymphony.oscache.base.events; | |
6 | ||
7 | import com.opensymphony.oscache.base.Cache; | |
8 | import com.opensymphony.oscache.base.CacheEntry; | |
9 | ||
10 | /** | |
11 | * CacheEntryEvent is the object created when an event occurs on a | |
12 | * cache entry (Add, update, remove, flush). It contains the entry itself and | |
13 | * its map. | |
14 | * | |
15 | * @version $Revision: 254 $ | |
16 | * @author <a href="mailto:fbeauregard@pyxis-tech.com">Francois Beauregard</a> | |
17 | */ | |
18 | public final class CacheEntryEvent extends CacheEvent { | |
19 | /** | |
20 | * The cache where the entry resides. | |
21 | */ | |
22 | private Cache map = null; | |
23 | ||
24 | /** | |
25 | * The entry that the event applies to. | |
26 | */ | |
27 | private CacheEntry entry = null; | |
28 | ||
29 | /** | |
30 | * Constructs a cache entry event object with no specified origin | |
31 | * | |
32 | * @param map The cache map of the cache entry | |
33 | * @param entry The cache entry that the event applies to | |
34 | */ | |
35 | 10 | public CacheEntryEvent(Cache map, CacheEntry entry) { |
36 | 10 | this(map, entry, null); |
37 | } | |
38 | ||
39 | /** | |
40 | * Constructs a cache entry event object | |
41 | * | |
42 | * @param map The cache map of the cache entry | |
43 | * @param entry The cache entry that the event applies to | |
44 | * @param origin The origin of this event | |
45 | */ | |
46 | 309 | public CacheEntryEvent(Cache map, CacheEntry entry, String origin) { |
47 | 309 | super(origin); |
48 | 309 | this.map = map; |
49 | 309 | this.entry = entry; |
50 | } | |
51 | ||
52 | /** | |
53 | * Retrieve the cache entry that the event applies to. | |
54 | */ | |
55 | 20 | public CacheEntry getEntry() { |
56 | 20 | return entry; |
57 | } | |
58 | ||
59 | /** | |
60 | * Retrieve the cache entry key | |
61 | */ | |
62 | 29 | public String getKey() { |
63 | 29 | return entry.getKey(); |
64 | } | |
65 | ||
66 | /** | |
67 | * Retrieve the cache map where the entry resides. | |
68 | */ | |
69 | 20 | public Cache getMap() { |
70 | 20 | return map; |
71 | } | |
72 | ||
73 | 0 | public String toString() { |
74 | 0 | return "key=" + entry.getKey(); |
75 | } | |
76 | } |
|