Class UserPassKey
- java.lang.Object
-
- org.apache.commons.dbcp.datasources.UserPassKey
-
- All Implemented Interfaces:
java.io.Serializable
class UserPassKey extends java.lang.Object implements java.io.Serializable
Holds a username, password pair. Serves as a poolable object key for the KeyedObjectPool backing a SharedPoolDataSource. Two instances with the same username are considered equal. This ensures that there will be only one keyed pool for each user in the pool. The password is used (along with the username) by the KeyedCPDSConnectionFactory when creating new connections.
InstanceKeyDataSource.getConnection(String, String)
validates that the password used to create a connection matches the password provided by the client.- Version:
- $Revision: 907288 $ $Date: 2010-02-06 14:42:58 -0500 (Sat, 06 Feb 2010) $
-
-
Field Summary
Fields Modifier and Type Field Description private java.lang.String
password
private static long
serialVersionUID
private java.lang.String
username
-
Constructor Summary
Constructors Constructor Description UserPassKey(java.lang.String username, java.lang.String password)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description boolean
equals(java.lang.Object obj)
java.lang.String
getPassword()
Get the value of password.java.lang.String
getUsername()
Get the value of username.int
hashCode()
Returns the hash of the username.java.lang.String
toString()
-
-
-
Field Detail
-
serialVersionUID
private static final long serialVersionUID
- See Also:
- Constant Field Values
-
password
private final java.lang.String password
-
username
private final java.lang.String username
-
-
Method Detail
-
getPassword
public java.lang.String getPassword()
Get the value of password.- Returns:
- value of password.
-
getUsername
public java.lang.String getUsername()
Get the value of username.- Returns:
- value of username.
-
equals
public boolean equals(java.lang.Object obj)
- Overrides:
equals
in classjava.lang.Object
- Returns:
true
if the username fields for both objects are equal. Two instances with the same username but different passwords are considered equal.- See Also:
Object.equals(java.lang.Object)
-
hashCode
public int hashCode()
Returns the hash of the username.- Overrides:
hashCode
in classjava.lang.Object
-
toString
public java.lang.String toString()
- Overrides:
toString
in classjava.lang.Object
-
-