1 18 19 20 package sync4j.framework.core; 21 22 31 public final class VerProto 32 implements java.io.Serializable { 33 34 36 private String version; 37 38 40 43 protected VerProto() {} 44 45 51 public VerProto(final String version) { 52 setVersion(version); 53 } 54 55 57 63 public String getVersion() { 64 return version; 65 } 66 67 74 public void setVersion(String version) { 75 if (version == null) { 76 throw new IllegalArgumentException ("version cannot be null"); 77 } 78 this.version = version; 79 } 80 81 92 public boolean equals(Object obj) { 93 if (obj == null) { 94 return false; 95 } 96 97 String s = null; 98 if (obj instanceof VerProto) { 99 s = ((VerProto)obj).getVersion(); 100 } else if (obj instanceof String ) { 101 s = (String )obj; 102 } else { 103 s = String.valueOf(obj); 104 } 105 106 return (s.equals(version)); 107 } 108 } 109 | Popular Tags |