Class ImmutableUser
java.lang.Object
com.atlassian.crowd.embedded.impl.ImmutableUser
- All Implemented Interfaces:
User
,Serializable
,Comparable<User>
,Principal
A general purpose immutable implementation of the User interface.
Note: This object does not allow null username or directoryId.
- See Also:
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionstatic final class
Used to aid in the construction of an Immutable User object. -
Constructor Summary
ConstructorsConstructorDescriptionImmutableUser
(long directoryId, String name, String displayName, String emailAddress, boolean active) -
Method Summary
Modifier and TypeMethodDescriptionint
CompareTo must be compatible with the equals() and hashCode() methodsboolean
Implementations must ensure equality based on getDirectoryId() and case-insensitive getName().static ImmutableUser
long
getName()
int
hashCode()
Implementations must produce a hashcode based on getDirectoryId() and case-insensitive getName().boolean
isActive()
static ImmutableUser.Builder
newUser()
static ImmutableUser.Builder
Creates a new User Builder by cloning the values from the supplied User.Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, toString, wait, wait, wait
Methods inherited from interface com.atlassian.crowd.embedded.api.User
isMarkedAsDeleted
-
Constructor Details
-
ImmutableUser
-
-
Method Details
-
from
- Returns:
- an
ImmutableUser
with the same properties as the given user. Will avoid creating a copy if possible.
-
isActive
public boolean isActive() -
getDirectoryId
public long getDirectoryId()- Specified by:
getDirectoryId
in interfaceUser
- Returns:
- id of the directory in which the User is stored.
-
getName
-
getEmailAddress
- Specified by:
getEmailAddress
in interfaceUser
- Returns:
- email address of the user.
-
getDisplayName
- Specified by:
getDisplayName
in interfaceUser
- Returns:
- display name (eg. full name) of the user, must never be null.
-
equals
Description copied from interface:User
Implementations must ensure equality based on getDirectoryId() and case-insensitive getName(). -
hashCode
public int hashCode()Description copied from interface:User
Implementations must produce a hashcode based on getDirectoryId() and case-insensitive getName(). -
compareTo
Description copied from interface:User
CompareTo must be compatible with the equals() and hashCode() methods- Specified by:
compareTo
in interfaceComparable<User>
- Specified by:
compareTo
in interfaceUser
-
newUser
-
newUser
Creates a new User Builder by cloning the values from the supplied User.- Parameters:
user
- user to be cloned.- Returns:
- a User Builder containing the values from the supplied User.
-