1 package org.jboss.cache.notifications; 2 3 import java.util.Arrays ; 4 5 11 public class CacheListenerEvent 12 { 13 public enum ListenerMethod 14 { 15 NODE_CREATED, NODE_MODIFIED, NODE_REMOVED, NODE_VISITED, NODE_EVICTED, NODE_LOADED, NODE_MOVED, NODE_ACTIVATED, 16 NODE_PASSIVATED, CACHE_STARTED, CACHE_STOPPED, VIEW_CHANGE 17 } 18 19 private ListenerMethod methodName; 20 private Object [] args; 21 22 public CacheListenerEvent(ListenerMethod methodName, Object ... args) 23 { 24 this.methodName = methodName; 25 this.args = args; 26 } 27 28 public Object [] getArgs() 29 { 30 return args; 31 } 32 33 public String toString() 34 { 35 StringBuilder b = new StringBuilder ("CacheListenerEvent methodName="); 36 b.append(methodName); 37 b.append(" {"); 38 for (Object o : args) 39 { 40 b.append(o); 41 b.append(", "); 42 } 43 b.append("}"); 44 return b.toString(); 45 } 46 47 48 public boolean equals(Object o) 49 { 50 if (this == o) return true; 51 if (o == null || getClass() != o.getClass()) return false; 52 53 CacheListenerEvent event = (CacheListenerEvent) o; 54 55 if (!Arrays.equals(args, event.args)) return false; 57 if (methodName != event.methodName) return false; 58 59 return true; 60 } 61 62 public int hashCode() 63 { 64 int result; 65 result = (methodName != null ? methodName.hashCode() : 0); 66 result = 31 * result + (args != null ? Arrays.hashCode(args) : 0); 67 return result; 68 } 69 } 70 | Popular Tags |