Chnaged to use setters in essence "copy constructor"

This commit is contained in:
Luke Taylor 2006-05-21 02:17:14 +00:00
parent 360e9908b7
commit c1e76b64bc
1 changed files with 15 additions and 12 deletions

View File

@ -104,16 +104,16 @@ public class LdapUserDetailsImpl implements LdapUserDetails {
} }
public Essence(LdapUserDetails copyMe) { public Essence(LdapUserDetails copyMe) {
instance.dn = copyMe.getDn(); setDn(copyMe.getDn());
instance.attributes = copyMe.getAttributes(); setAttributes(copyMe.getAttributes());
instance.username = copyMe.getUsername(); setUsername(copyMe.getUsername());
instance.password = copyMe.getPassword(); setPassword(copyMe.getPassword());
instance.enabled = copyMe.isEnabled(); setEnabled(copyMe.isEnabled());
instance.accountNonExpired = copyMe.isAccountNonExpired(); setAccountNonExpired(copyMe.isAccountNonExpired());
instance.credentialsNonExpired = copyMe.isCredentialsNonExpired(); setCredentialsNonExpired(copyMe.isCredentialsNonExpired());
instance.accountNonLocked = copyMe.isAccountNonLocked(); setAccountNonLocked(copyMe.isAccountNonLocked());
instance.controls = copyMe.getControls(); setControls(copyMe.getControls());
mutableAuthorities = new ArrayList(Arrays.asList(copyMe.getAuthorities())); setAuthorities(copyMe.getAuthorities());
} }
public Essence setDn(String dn) { public Essence setDn(String dn) {
@ -157,8 +157,7 @@ public class LdapUserDetailsImpl implements LdapUserDetails {
} }
public Essence setAuthorities(GrantedAuthority[] authorities) { public Essence setAuthorities(GrantedAuthority[] authorities) {
mutableAuthorities = Arrays.asList(authorities); mutableAuthorities = new ArrayList(Arrays.asList(authorities));
return this; return this;
} }
@ -172,6 +171,10 @@ public class LdapUserDetailsImpl implements LdapUserDetails {
return (GrantedAuthority[])mutableAuthorities.toArray(new GrantedAuthority[0]); return (GrantedAuthority[])mutableAuthorities.toArray(new GrantedAuthority[0]);
} }
public void setControls(Control[] controls) {
instance.controls = controls;
}
public LdapUserDetails createUserDetails() { public LdapUserDetails createUserDetails() {
//TODO: Validation of properties //TODO: Validation of properties