/** * Returns {@link #getPrincipals() principals}.toString() if they are not null, otherwise prints out the string * "empty" * * @return the String representation of this Account object. */ public String toString() { return getPrincipals() != null ? getPrincipals().toString() : "empty"; }
/** * If the {@link #getPrincipals() principals} are not null, returns <code>principals.hashCode()</code>, otherwise * returns 0 (zero). * * @return <code>principals.hashCode()</code> if they are not null, 0 (zero) otherwise. */ public int hashCode() { return (getPrincipals() != null ? getPrincipals().hashCode() : 0); }
/** * Returns <code>true</code> if the specified object is also a {@link SimpleAccount SimpleAccount} and its * {@link #getPrincipals() principals} are equal to this object's <code>principals</code>, <code>false</code> otherwise. * * @param o the object to test for equality. * @return <code>true</code> if the specified object is also a {@link SimpleAccount SimpleAccount} and its * {@link #getPrincipals() principals} are equal to this object's <code>principals</code>, <code>false</code> otherwise. */ public boolean equals(Object o) { if (o == this) { return true; } if (o instanceof SimpleAccount) { SimpleAccount sa = (SimpleAccount) o; //principal should be unique across the application, so only check this for equality: return (getPrincipals() != null ? getPrincipals().equals(sa.getPrincipals()) : sa.getPrincipals() == null); } return false; }
protected String getUsername(SimpleAccount account) { return getUsername(account.getPrincipals()); }
/** * If the {@link #getPrincipals() principals} are not null, returns <code>principals.hashCode()</code>, otherwise * returns 0 (zero). * * @return <code>principals.hashCode()</code> if they are not null, 0 (zero) otherwise. */ public int hashCode() { return (getPrincipals() != null ? getPrincipals().hashCode() : 0); }
/** * Returns {@link #getPrincipals() principals}.toString() if they are not null, otherwise prints out the string * "empty" * * @return the String representation of this Account object. */ public String toString() { return getPrincipals() != null ? getPrincipals().toString() : "empty"; }
/** * Returns <code>true</code> if the specified object is also a {@link SimpleAccount SimpleAccount} and its * {@link #getPrincipals() principals} are equal to this object's <code>principals</code>, <code>false</code> otherwise. * * @param o the object to test for equality. * @return <code>true</code> if the specified object is also a {@link SimpleAccount SimpleAccount} and its * {@link #getPrincipals() principals} are equal to this object's <code>principals</code>, <code>false</code> otherwise. */ public boolean equals(Object o) { if (o == this) { return true; } if (o instanceof SimpleAccount) { SimpleAccount sa = (SimpleAccount) o; //principal should be unique across the application, so only check this for equality: return (getPrincipals() != null ? getPrincipals().equals(sa.getPrincipals()) : sa.getPrincipals() == null); } return false; }
protected String getUsername(SimpleAccount account) { return getUsername(account.getPrincipals()); }
/** * Returns {@link #getPrincipals() principals}.toString() if they are not null, otherwise prints out the string * "empty" * * @return the String representation of this Account object. */ public String toString() { return getPrincipals() != null ? getPrincipals().toString() : "empty"; }
/** * If the {@link #getPrincipals() principals} are not null, returns <code>principals.hashCode()</code>, otherwise * returns 0 (zero). * * @return <code>principals.hashCode()</code> if they are not null, 0 (zero) otherwise. */ public int hashCode() { return (getPrincipals() != null ? getPrincipals().hashCode() : 0); }
/** * Returns <code>true</code> if the specified object is also a {@link SimpleAccount SimpleAccount} and its * {@link #getPrincipals() principals} are equal to this object's <code>principals</code>, <code>false</code> otherwise. * * @param o the object to test for equality. * @return <code>true</code> if the specified object is also a {@link SimpleAccount SimpleAccount} and its * {@link #getPrincipals() principals} are equal to this object's <code>principals</code>, <code>false</code> otherwise. */ public boolean equals(Object o) { if (o == this) { return true; } if (o instanceof SimpleAccount) { SimpleAccount sa = (SimpleAccount) o; //principal should be unique across the application, so only check this for equality: return (getPrincipals() != null ? getPrincipals().equals(sa.getPrincipals()) : sa.getPrincipals() == null); } return false; }
protected String getUsername(SimpleAccount account) { return getUsername(account.getPrincipals()); }