NIHVIVO-1385 Add toString() method to help in debugging. As long as we are here, clean up compiler warnings.

This commit is contained in:
jeb228 2011-02-18 20:07:57 +00:00
parent d41a64c60e
commit 029465e4de

View file

@ -107,6 +107,7 @@ public class User implements Comparable<User> {
this.firstName = firstName; this.firstName = firstName;
} }
@Override
public int compareTo(User other) { public int compareTo(User other) {
Collator collator = Collator.getInstance(); Collator collator = Collator.getInstance();
if( this.getUsername() == null && other.getUsername() == null ) if( this.getUsername() == null && other.getUsername() == null )
@ -119,4 +120,18 @@ public class User implements Comparable<User> {
return collator.compare(this.getUsername(),other.getUsername()); return collator.compare(this.getUsername(),other.getUsername());
} }
@Override
public String toString() {
return "User[URI=" + URI + ", namespace=" + namespace + ", localName="
+ localName + ", username=" + username + ", oldPassword="
+ oldPassword + ", md5password=" + md5password + ", modTime="
+ dateToString(modTime) + ", firstTime="
+ dateToString(firstTime) + ", loginCount=" + loginCount
+ ", roleURI=" + roleURI + ", lastName=" + lastName
+ ", firstName=" + firstName + "]";
}
private String dateToString(Date date) {
return (date == null) ? "null" : String.valueOf(date.getTime());
}
} }