| 1 package com.tirsen.nanning.samples.prevayler; 2 3 import com.tirsen.nanning.attribute.Attributes; 4 5 import java.io.Serializable ; 6 7 13 public class Identity implements Serializable { 14 static final long serialVersionUID = 716500751463534855L; 15 16 private Class objectClass; 17 private Object identifier; 18 19 public Identity(Class objectClass, Object identifier) { 20 this.objectClass = objectClass; 21 this.identifier = identifier; 22 } 23 24 public Class getObjectClass() { 25 return objectClass; 26 } 27 28 public Object getIdentifier() { 29 return identifier; 30 } 31 32 public boolean equals(Object o) { 33 if (this == o) return true; 34 if (!(o instanceof Identity)) return false; 35 36 final Identity identity = (Identity) o; 37 38 if (!identifier.equals(identity.identifier)) return false; 39 if (!objectClass.equals(identity.objectClass)) return false; 40 41 return true; 42 } 43 44 public int hashCode() { 45 int result; 46 result = objectClass.hashCode(); 47 result = 29 * result + identifier.hashCode(); 48 return result; 49 } 50 51 public String toString() { 52 return this + "[objectClass=" + objectClass + ",identifier=" + identifier + "]"; 53 } 54 55 } 56 | Popular Tags |