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 classUsed 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 TypeMethodDescriptionintCompareTo must be compatible with the equals() and hashCode() methodsbooleanImplementations must ensure equality based on getDirectoryId() and case-insensitive getName().static ImmutableUserlonggetName()inthashCode()Implementations must produce a hashcode based on getDirectoryId() and case-insensitive getName().booleanisActive()static ImmutableUser.BuildernewUser()static ImmutableUser.BuilderCreates 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, waitMethods inherited from interface com.atlassian.crowd.embedded.api.User
isMarkedAsDeleted
-
Constructor Details
-
ImmutableUser
-
-
Method Details
-
from
- Returns:
- an
ImmutableUserwith the same properties as the given user. Will avoid creating a copy if possible.
-
isActive
public boolean isActive() -
getDirectoryId
public long getDirectoryId()- Specified by:
getDirectoryIdin interfaceUser- Returns:
- id of the directory in which the User is stored.
-
getName
-
getEmailAddress
- Specified by:
getEmailAddressin interfaceUser- Returns:
- email address of the user.
-
getDisplayName
- Specified by:
getDisplayNamein interfaceUser- Returns:
- display name (eg. full name) of the user, must never be null.
-
equals
Description copied from interface:UserImplementations must ensure equality based on getDirectoryId() and case-insensitive getName(). -
hashCode
public int hashCode()Description copied from interface:UserImplementations must produce a hashcode based on getDirectoryId() and case-insensitive getName(). -
compareTo
Description copied from interface:UserCompareTo must be compatible with the equals() and hashCode() methods- Specified by:
compareToin interfaceComparable<User>- Specified by:
compareToin 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.
-