|
|||||||||||||||||||
| Source file | Conditionals | Statements | Methods | TOTAL | |||||||||||||||
| CacheGroupEvent.java | - | 85,7% | 80% | 83,3% |
|
||||||||||||||
| 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 | ||
| 9 | /** | |
| 10 | * CacheGroupEvent is an event that occurs at the cache group level | |
| 11 | * (Add, update, remove, flush). It contains the group name and the | |
| 12 | * originating cache object. | |
| 13 | * | |
| 14 | * @version $Revision: 254 $ | |
| 15 | * @author <a href="mailto:chris@swebtec.com">Chris Miller</a> | |
| 16 | */ | |
| 17 | public final class CacheGroupEvent extends CacheEvent { | |
| 18 | /** | |
| 19 | * The cache where the entry resides. | |
| 20 | */ | |
| 21 | private Cache map = null; | |
| 22 | ||
| 23 | /** | |
| 24 | * The group that the event applies to. | |
| 25 | */ | |
| 26 | private String group = null; | |
| 27 | ||
| 28 | /** | |
| 29 | * Constructs a cache group event with no origin | |
| 30 | * | |
| 31 | * @param map The cache map of the cache entry | |
| 32 | * @param group The cache group that the event applies to. | |
| 33 | */ | |
| 34 | 5 | public CacheGroupEvent(Cache map, String group) { |
| 35 | 5 | this(map, group, null); |
| 36 | } | |
| 37 | ||
| 38 | /** | |
| 39 | * Constructs a cache group event | |
| 40 | * | |
| 41 | * @param map The cache map of the cache entry | |
| 42 | * @param group The cache group that the event applies to. | |
| 43 | * @param origin An optional tag that can be attached to the event to | |
| 44 | * specify the event's origin. This is useful to prevent events from being | |
| 45 | * fired recursively in some situations, such as when an event handler | |
| 46 | * causes another event to be fired. | |
| 47 | */ | |
| 48 | 65 | public CacheGroupEvent(Cache map, String group, String origin) { |
| 49 | 65 | super(origin); |
| 50 | 65 | this.map = map; |
| 51 | 65 | this.group = group; |
| 52 | } | |
| 53 | ||
| 54 | /** | |
| 55 | * Retrieve the cache group that the event applies to. | |
| 56 | */ | |
| 57 | 34 | public String getGroup() { |
| 58 | 34 | return group; |
| 59 | } | |
| 60 | ||
| 61 | /** | |
| 62 | * Retrieve the cache map where the group resides. | |
| 63 | */ | |
| 64 | 10 | public Cache getMap() { |
| 65 | 10 | return map; |
| 66 | } | |
| 67 | ||
| 68 | 0 | public String toString() { |
| 69 | 0 | return "groupName=" + group; |
| 70 | } | |
| 71 | } |
|
||||||||||