1 46 47 package org.mr.ra; 48 49 import javax.resource.spi.ConnectionRequestInfo ; 50 import java.io.Serializable ; 51 52 53 58 public class ConnectionRequestInfoImpl 59 implements ConnectionRequestInfo , Serializable , Cloneable 60 { 61 private static final long serialVersionUID = 3618140056549077045L; 62 63 private String userName = null; 64 private String password = null; 65 66 public ConnectionRequestInfoImpl copy() { 67 try { 68 return (ConnectionRequestInfoImpl) clone(); 69 } 70 catch (CloneNotSupportedException e) { 71 throw new RuntimeException ("Could not clone: ", e); 72 } 73 } 74 75 76 79 public int hashCode() { 80 int seed = 23; 81 int factor = 37; 82 seed = seed*factor+userName.hashCode(); 83 seed = seed*factor+password.hashCode(); 84 return seed; 85 } 86 87 88 91 public boolean equals(Object o) { 92 if (o == null) { 93 return false; 94 } 95 if (!getClass().equals(o.getClass())) { 96 return false; 97 } 98 ConnectionRequestInfoImpl i = (ConnectionRequestInfoImpl) o; 99 if (notEqual(userName, i.userName)) { 100 return false; 101 } 102 if (notEqual(password, i.password)) { 103 return false; 104 } 105 return true; 106 } 107 108 109 113 private boolean notEqual(Object o1, Object o2) { 114 return (o1 == null ^ o2 == null) || (o1 != null && !o1.equals(o2)); 115 } 116 117 118 121 public String getPassword() { 122 return password; 123 } 124 125 128 public void setPassword(String password) { 129 this.password = password; 130 } 131 132 135 public String getUserName() { 136 return userName; 137 } 138 139 142 public void setUserName(String userid) { 143 this.userName = userid; 144 } 145 146 147 public String toString() { 148 return "ConnectionRequestInfoImpl{ " + 149 "userName = '" + userName + "' " + 150 ", password = '" + password + "' " + 151 " }"; 152 } 153 } 154 | Popular Tags |