Class ValkeyPassword
java.lang.Object
io.valkey.springframework.data.valkey.connection.ValkeyPassword
Value object which may or may not contain a Valkey password.
If a password is present, isPresent() will return true and get() will return the value.
The password is stored as character array.
- Since:
- 2.0
- Author:
- Mark Paluch, Christoph Strobl
-
Method Summary
Modifier and TypeMethodDescriptionbooleanchar[]get()Return the password value if present.inthashCode()booleanReturntrueif there is a password present, otherwisefalse.<R> Optional<R>static ValkeyPasswordnone()Create an absentValkeyPassword.static ValkeyPasswordof(char[] passwordAsChars) Create aValkeyPasswordfrom achararray.static ValkeyPasswordCreate aValkeyPasswordfrom aString.Optional<char[]>Adopt the password toOptionalcontaining the password value.toString()
-
Method Details
-
of
Create aValkeyPasswordfrom aString.- Parameters:
passwordAsString- the password as string.- Returns:
- the
ValkeyPasswordforpasswordAsString.
-
of
Create aValkeyPasswordfrom achararray.- Parameters:
passwordAsChars- the password as char array.- Returns:
- the
ValkeyPasswordforpasswordAsChars.
-
none
Create an absentValkeyPassword.- Returns:
- the absent
ValkeyPassword.
-
isPresent
public boolean isPresent()Returntrueif there is a password present, otherwisefalse.- Returns:
trueif there is a password present, otherwisefalse
-
get
Return the password value if present. ThrowsNoSuchElementExceptionif the password is absent.- Returns:
- the password.
- Throws:
NoSuchElementException- if the password is absent.
-
map
Map the password using aFunctionand return aOptionalcontaining the mapped value.Absent passwords return a
Optional.empty().- Parameters:
mapper- must not be null.- Returns:
- the mapped result.
-
toOptional
Adopt the password toOptionalcontaining the password value.Absent passwords return a
Optional.empty().- Returns:
- the
Optionalcontaining the password value.
-
toString
-
equals
-
hashCode
public int hashCode()
-