Forcing User to default to empty set of Roles

This commit is contained in:
Adam Lowe 2012-04-27 16:40:29 +01:00
parent 7033076f00
commit fc2d949ae2
1 changed files with 7 additions and 1 deletions

View File

@ -98,11 +98,17 @@ public class User implements Comparable<User> {
protected final String name;
protected final Set<Role> roles;
public User(String id, String name, Set<Role> roles) {
protected User(String id, String name, Set<Role> roles) {
this.id = checkNotNull(id, "id");
this.name = checkNotNull(name, "name");
this.roles = ImmutableSet.copyOf(checkNotNull(roles, "roles"));
}
protected User() {
id = null;
name = null;
roles = ImmutableSet.of();
}
/**
* When providing an ID, it is assumed that the user exists in the current OpenStack deployment