1 16 package net.sf.dozer.util.mapping.cache; 17 18 import org.apache.commons.lang.builder.EqualsBuilder; 19 import org.apache.commons.lang.builder.ReflectionToStringBuilder; 20 import org.apache.commons.lang.builder.ToStringStyle; 21 22 25 public class CacheEntry { 26 private final Object key; 27 private final Object value; 28 private final long creationTime; 29 30 public CacheEntry(Object key, Object value) { 31 this.key = key; 32 this.value = value; 33 this.creationTime = System.currentTimeMillis(); 34 } 35 36 public Object getKey() { 37 return key; 38 } 39 40 public Object getValue() { 41 return value; 42 } 43 44 public long getCreationTime() { 45 return creationTime; 46 } 47 48 public int hashCode() { 49 return key.hashCode(); 50 } 51 52 public boolean equals(Object object) { 53 if ( (this == object ) ) { return true; } 54 if ( !(object instanceof CacheEntry) ) { return false; } 55 CacheEntry entry = (CacheEntry) object; 56 return new EqualsBuilder().append(this.getKey(), entry.getKey()).isEquals(); 57 } 58 59 public String toString() { 60 return ReflectionToStringBuilder.toString(this, ToStringStyle.MULTI_LINE_STYLE); 61 } 62 } 63 | Popular Tags |