|
|||||||||||||||||||
| Source file | Conditionals | Statements | Methods | TOTAL | |||||||||||||||
| CachePatternEvent.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 | * A CachePatternEvent is fired when a pattern has been applied to a cache. | |
| 11 | * | |
| 12 | * @version $Revision: 254 $ | |
| 13 | * @author <a href="mailto:chris@swebtec.com">Chris Miller</a> | |
| 14 | */ | |
| 15 | public final class CachePatternEvent extends CacheEvent { | |
| 16 | /** | |
| 17 | * The cache the pattern is being applied to. | |
| 18 | */ | |
| 19 | private Cache map = null; | |
| 20 | ||
| 21 | /** | |
| 22 | * The pattern that is being applied. | |
| 23 | */ | |
| 24 | private String pattern = null; | |
| 25 | ||
| 26 | /** | |
| 27 | * Constructs a cache pattern event with no origin | |
| 28 | * | |
| 29 | * @param map The cache map that the pattern was applied to | |
| 30 | * @param pattern The pattern that was applied | |
| 31 | */ | |
| 32 | 25 | public CachePatternEvent(Cache map, String pattern) { |
| 33 | 25 | this(map, pattern, null); |
| 34 | } | |
| 35 | ||
| 36 | /** | |
| 37 | * Constructs a cache pattern event | |
| 38 | * | |
| 39 | * @param map The cache map that the pattern was applied to | |
| 40 | * @param pattern The cache pattern that the event applies to. | |
| 41 | * @param origin An optional tag that can be attached to the event to | |
| 42 | * specify the event's origin. This is useful to prevent events from being | |
| 43 | * fired recursively in some situations, such as when an event handler | |
| 44 | * causes another event to be fired, or for logging purposes. | |
| 45 | */ | |
| 46 | 62 | public CachePatternEvent(Cache map, String pattern, String origin) { |
| 47 | 62 | super(origin); |
| 48 | 62 | this.map = map; |
| 49 | 62 | this.pattern = pattern; |
| 50 | } | |
| 51 | ||
| 52 | /** | |
| 53 | * Retrieve the cache map that had the pattern applied. | |
| 54 | */ | |
| 55 | 30 | public Cache getMap() { |
| 56 | 30 | return map; |
| 57 | } | |
| 58 | ||
| 59 | /** | |
| 60 | * Retrieve the pattern that was applied to the cache. | |
| 61 | */ | |
| 62 | 31 | public String getPattern() { |
| 63 | 31 | return pattern; |
| 64 | } | |
| 65 | ||
| 66 | 0 | public String toString() { |
| 67 | 0 | return "pattern=" + pattern; |
| 68 | } | |
| 69 | } |
|
||||||||||