public final class ImmutableUsernamePassword extends Object implements UsernamePassword
UsernamePassword.
Use the builder to create immutable instances:
ImmutableUsernamePassword.builder().
Use the static factory method to create immutable instances:
ImmutableUsernamePassword.of().
| Modifier and Type | Class and Description |
|---|---|
static class |
ImmutableUsernamePassword.Builder
Builds instances of type
ImmutableUsernamePassword. |
| Modifier and Type | Method and Description |
|---|---|
static ImmutableUsernamePassword.Builder |
builder()
Creates a builder for
ImmutableUsernamePassword. |
static ImmutableUsernamePassword |
copyOf(UsernamePassword instance)
Creates an immutable copy of a
UsernamePassword value. |
boolean |
equals(Object another)
This instance is equal to all instances of
ImmutableUsernamePassword that have equal attribute values. |
int |
hashCode()
Computes a hash code from attributes:
name, password. |
String |
name() |
static ImmutableUsernamePassword |
of(String name,
char[] password)
Construct a new immutable
UsernamePassword instance. |
char[] |
password() |
String |
toString()
Prints the immutable value
UsernamePassword with attribute values. |
ImmutableUsernamePassword |
withName(String value)
Copy the current immutable object by setting a value for the
name attribute. |
ImmutableUsernamePassword |
withPassword(char... elements)
Copy the current immutable object with elements that replace the content of
password. |
clone, finalize, getClass, notify, notifyAll, wait, wait, waitof, passwordAsStringpublic String name()
name in interface UsernamePasswordname attributepublic char[] password()
password in interface UsernamePasswordpassword arraypublic final ImmutableUsernamePassword withName(String value)
name attribute.
An equals check used to prevent copying of the same value by returning this.value - A new value for namethis objectpublic final ImmutableUsernamePassword withPassword(char... elements)
password.
The array is cloned before being saved as attribute values.elements - The non-null elements for passwordthis objectpublic boolean equals(Object another)
ImmutableUsernamePassword that have equal attribute values.public int hashCode()
name, password.public String toString()
UsernamePassword with attribute values.public static ImmutableUsernamePassword of(String name, char[] password)
UsernamePassword instance.of in interface UsernamePasswordname - The value for the name attributepassword - The value for the password attributepublic static ImmutableUsernamePassword copyOf(UsernamePassword instance)
UsernamePassword 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 ImmutableUsernamePassword.Builder builder()
ImmutableUsernamePassword.
ImmutableUsernamePassword.builder()
.name(String) // required name
.password(char) // required password
.build();
Copyright © 2024. All rights reserved.