Modifier and Type | Class and Description |
---|---|
static class |
User.Role |
Modifier and Type | Method and Description |
---|---|
int |
compareTo(User other) |
boolean |
equals(java.lang.Object obj) |
java.lang.String |
getName()
Returns the
name of this User . |
java.util.Optional<java.lang.String> |
getPassword()
|
java.util.Optional<User.Role> |
getRole()
|
int |
hashCode() |
java.lang.String |
toString() |
static User |
with(java.lang.String name)
Factory method used to construct a new
User initialized with the given name . |
User |
withPassword(java.lang.String password)
Builder method used to set this
User's password . |
User |
withRole(User.Role role)
|
public static User with(java.lang.String name)
User
initialized with the given name
.name
- String
containing the name of the User
.User
initialized witht he given name
.java.lang.IllegalArgumentException
- if name
is null or empty.User(String)
public java.lang.String getName()
name
of this User
.String
containing the User's
name.public java.util.Optional<java.lang.String> getPassword()
Optional
String
containing User's
password.Optional
public java.util.Optional<User.Role> getRole()
public User withPassword(java.lang.String password)
User's
password
.public int compareTo(User other)
compareTo
in interface java.lang.Comparable<User>
public boolean equals(java.lang.Object obj)
equals
in class java.lang.Object
public int hashCode()
hashCode
in class java.lang.Object
public java.lang.String toString()
toString
in class java.lang.Object