1 17 package org.apache.geronimo.system.plugin; 18 19 import org.apache.geronimo.kernel.repository.Version; 20 21 33 public class SnapshotVersion extends Version { 34 private static final long serialVersionUID = -4165276456639945508L; 35 36 private Integer buildNumber; 37 38 private String timestamp; 39 40 public SnapshotVersion(Version version) { 41 super(version.toString()); 42 } 43 44 public SnapshotVersion(String version) { 45 super(version); 46 } 47 48 public int getBuildNumber() { 49 return buildNumber != null ? buildNumber.intValue() : 0; 50 } 51 52 public void setBuildNumber(int buildNumber) { 53 this.buildNumber = new Integer (buildNumber); 54 } 55 56 public String getTimestamp() { 57 return timestamp; 58 } 59 60 public void setTimestamp(String timestamp) { 61 this.timestamp = timestamp; 62 } 63 64 public boolean equals(Object other) { 65 if (super.equals(other)) { 66 if (other instanceof SnapshotVersion) { 67 SnapshotVersion v = (SnapshotVersion) other; 68 if (buildNumber == null ? v.buildNumber != null : !buildNumber.equals(v.buildNumber)) { 69 return false; 70 } 71 if (timestamp == null ? v.timestamp != null : !timestamp.equals(v.timestamp)) { 72 return false; 73 } 74 return true; 75 } 76 } 77 return false; 78 } 79 80 public int hashCode() { 81 int hashCode = super.hashCode(); 82 if (buildNumber != null) { 83 hashCode = 37 * hashCode + buildNumber.hashCode(); 84 } 85 if (timestamp != null) { 86 hashCode = 37 * hashCode + timestamp.hashCode(); 87 } 88 return hashCode; 89 } 90 } 91 | Popular Tags |