public final class ImmutableUser extends Object implements AuthenticationSetup.User
AuthenticationSetup.User.
Use the builder to create immutable instances:
ImmutableUser.builder().
Use the static factory method to create immutable instances:
ImmutableUser.of().
| Modifier and Type | Class and Description |
|---|---|
static class |
ImmutableUser.Builder
Builds instances of type
ImmutableUser. |
| Modifier and Type | Method and Description |
|---|---|
static ImmutableUser.Builder |
builder()
Creates a builder for
ImmutableUser. |
static ImmutableUser |
copyOf(AuthenticationSetup.User instance)
Creates an immutable copy of a
AuthenticationSetup.User value. |
String |
database() |
boolean |
equals(Object another)
This instance is equal to all instances of
ImmutableUser that have equal attribute values. |
int |
hashCode()
Computes a hash code from attributes:
database, user, roles. |
static ImmutableUser |
of(String database,
UsernamePassword user)
Construct a new immutable
User instance. |
List<String> |
roles() |
String |
toString()
Prints the immutable value
User with attribute values. |
UsernamePassword |
user() |
ImmutableUser |
withDatabase(String value)
Copy the current immutable object by setting a value for the
database attribute. |
ImmutableUser |
withRoles(Iterable<String> elements)
Copy the current immutable object with elements that replace the content of
roles. |
ImmutableUser |
withRoles(String... elements)
Copy the current immutable object with elements that replace the content of
roles. |
ImmutableUser |
withUser(UsernamePassword value)
Copy the current immutable object by setting a value for the
user attribute. |
public String database()
database in interface AuthenticationSetup.Userdatabase attributepublic UsernamePassword user()
user in interface AuthenticationSetup.Useruser attributepublic List<String> roles()
roles in interface AuthenticationSetup.Userroles attributepublic final ImmutableUser withDatabase(String value)
database attribute.
An equals check used to prevent copying of the same value by returning this.value - A new value for databasethis objectpublic final ImmutableUser withUser(UsernamePassword value)
user attribute.
A shallow reference equality check is used to prevent copying of the same value by returning this.value - A new value for userthis objectpublic final ImmutableUser withRoles(String... elements)
roles.elements - The elements to setthis objectpublic final ImmutableUser withRoles(Iterable<String> elements)
roles.
A shallow reference equality check is used to prevent copying of the same value by returning this.elements - An iterable of roles elements to setthis objectpublic boolean equals(Object another)
ImmutableUser that have equal attribute values.public int hashCode()
database, user, roles.public String toString()
User with attribute values.public static ImmutableUser of(String database, UsernamePassword user)
User instance.database - The value for the database attributeuser - The value for the user attributepublic static ImmutableUser copyOf(AuthenticationSetup.User instance)
AuthenticationSetup.User value.
Uses accessors to get values to initialize the new immutable instance.
If an instance is already immutable, it is returned as is.instance - The instance to copypublic static ImmutableUser.Builder builder()
ImmutableUser.
ImmutableUser.builder()
.database(String) // required database
.user(de.flapdoodle.embed.mongo.client.UsernamePassword) // required user
.addRoles|addAllRoles(String) // roles elements
.build();
Copyright © 2023. All rights reserved.