1 19 package org.openharmonise.commons.cache; 20 21 31 public class CachePointer { 32 33 36 protected Object m_cache_key; 37 38 41 protected AbstractCache m_cache; 42 43 44 47 public CachePointer() { 48 49 } 50 51 58 public CachePointer(Object key,AbstractCache cache) { 59 m_cache_key=key; 60 m_cache = cache; 61 } 62 63 68 public AbstractCache getCache() { 69 return m_cache; 70 } 71 72 77 public Object getKey() { 78 return m_cache_key; 79 } 80 81 86 public void setCache(AbstractCache cache) { 87 this.m_cache = cache; 88 } 89 90 95 public void setKey(Object object) { 96 m_cache_key = object; 97 } 98 99 105 public Object getObject() throws CacheException { 106 return m_cache.getObject(m_cache_key); 107 } 108 109 112 public boolean equals(Object obj) { 113 boolean bEq = false; 114 115 if(obj instanceof CachePointer) { 116 CachePointer ptr = (CachePointer) obj; 117 118 if(this == ptr) { 119 bEq = true; 120 } else if(ptr.getCache().equals(m_cache) == true && ptr.getKey().equals(m_cache_key) == true) { 121 bEq = true; 122 } 123 } 124 return bEq; 125 } 126 127 } 128 | Popular Tags |