added createTarget method on Essence class to allow subclassing.

This commit is contained in:
Luke Taylor 2006-08-25 15:32:39 +00:00
parent b5cbc977e1
commit 92dcf694b4
1 changed files with 5 additions and 1 deletions

View File

@ -109,7 +109,7 @@ public class LdapUserDetailsImpl implements LdapUserDetails {
* Variation of essence pattern. Used to create mutable intermediate object
*/
public static class Essence {
LdapUserDetailsImpl instance = new LdapUserDetailsImpl();
LdapUserDetailsImpl instance = createTarget();
List mutableAuthorities = new ArrayList();
public Essence() {}
@ -127,6 +127,10 @@ public class LdapUserDetailsImpl implements LdapUserDetails {
setAuthorities(copyMe.getAuthorities());
}
LdapUserDetailsImpl createTarget() {
return new LdapUserDetailsImpl();
}
public Essence addAuthority(GrantedAuthority a) {
mutableAuthorities.add(a);