1 8 9 package com.sleepycat.persist.evolve; 10 11 import java.io.Serializable ; 12 13 19 public abstract class Mutation implements Serializable { 20 21 private static final long serialVersionUID = -8094431582953129268L; 22 23 private String className; 24 private int classVersion; 25 private String fieldName; 26 27 Mutation(String className, int classVersion, String fieldName) { 28 this.className = className; 29 this.classVersion = classVersion; 30 this.fieldName = fieldName; 31 } 32 33 36 public String getClassName() { 37 return className; 38 } 39 40 43 public int getClassVersion() { 44 return classVersion; 45 } 46 47 51 public String getFieldName() { 52 return fieldName; 53 } 54 55 59 @Override 60 public boolean equals(Object other) { 61 if (other instanceof Mutation) { 62 Mutation o = (Mutation) other; 63 return className.equals(o.className) && 64 classVersion == o.classVersion && 65 ((fieldName != null) ? fieldName.equals(o.fieldName) 66 : (o.fieldName == null)); 67 } else { 68 return false; 69 } 70 } 71 72 @Override 73 public int hashCode() { 74 return className.hashCode() + 75 classVersion + 76 ((fieldName != null) ? fieldName.hashCode() : 0); 77 } 78 79 @Override 80 public String toString() { 81 return "Class: " + className + " Version: " + classVersion + 82 ((fieldName != null) ? (" Field: " + fieldName) : ""); 83 } 84 } 85 | Popular Tags |