1 17 18 package org.objectweb.jac.aspects.distrans; 19 20 21 27 28 public class DataSource { 29 30 public String driver; 31 public String url; 32 public String user; 33 public String password; 34 35 public DataSource( 36 String driver, String url, String user, String password ) { 37 38 this.driver = driver; 39 this.url = url; 40 this.user = user; 41 this.password = password; 42 } 43 44 public boolean equals( Object other ) { 45 if ( this == other ) return true; 46 if ( ! (other instanceof DataSource) ) return false; 47 48 DataSource dsother = (DataSource) other; 49 return ( dsother.driver.equals(driver) && 50 dsother.url.equals(url) && 51 dsother.user.equals(user) && 52 dsother.password.equals(password) ); 53 } 54 55 public String toString() { 56 return 57 super.toString() + 58 "[" + driver + "," + url + "," + user + "," + password + "]"; 59 } 60 61 public int hashCode() { 62 63 int h1 = (driver==null) ? 0 : driver.hashCode() & 255; 64 int h2 = (url==null) ? 0 : url.hashCode() & 255; 65 int h3 = (user==null) ? 0 : user.hashCode() & 255; 66 int h4 = (password==null) ? 0 : password.hashCode() & 255; 67 68 return (h1<<24) + (h2<<16) + (h3<<8) + h4; 69 } 70 } 71 | Popular Tags |