UserMemento

Immutable serializable value holding details about a user and its roles.

API

UserMemento.java
class UserMemento {
  UserMemento(final String name, final Stream<RoleMemento> roles)     (1)
  UserMemento system()     (2)
  UserMemento ofName(final String name)     (3)
  UserMemento ofNameAndRoles(final String name, final RoleMemento... roles)     (4)
  UserMemento ofNameAndRoleNames(final String name, final String... roleNames)     (5)
  UserMemento ofNameAndRoleNames(final String name, final Stream<String> roleNames)     (6)
  String title()
  List<RoleMemento> getRoles()
  boolean isCurrentUser(final String userName)     (7)
  Stream<String> streamRoleNames()
  boolean hasRoleName(final String roleName)
  String toString()
  boolean equals(Object obj)
  int hashCode()
}
1 UserMemento(String, Stream)

Creates a new user with the specified name and assigned roles.

2 system()

The framework’s internal user with unrestricted privileges.

3 ofName(String)

Creates a new user with the specified name and no roles.

4 ofNameAndRoles(String, RoleMemento)

Creates a new user with the specified name and assigned roles.

5 ofNameAndRoleNames(String, String)

Creates a new user with the specified name and assigned role names.

6 ofNameAndRoleNames(String, Stream)

Creates a new user with the specified name and assigned role names.

7 isCurrentUser(String)

Determine if the specified name is this user.

Members

UserMemento(String, Stream)

Creates a new user with the specified name and assigned roles.

system()

The framework’s internal user with unrestricted privileges.

ofName(String)

Creates a new user with the specified name and no roles.

ofNameAndRoles(String, RoleMemento)

Creates a new user with the specified name and assigned roles.

ofNameAndRoleNames(String, String)

Creates a new user with the specified name and assigned role names.

ofNameAndRoleNames(String, Stream)

Creates a new user with the specified name and assigned role names.

isCurrentUser(String)

Determine if the specified name is this user.