public class RedisPassword extends Object
If a password is present, isPresent()
will return true
and get()
will return the value.
The password is stored as character array.
Modifier and Type | Method and Description |
---|---|
boolean |
equals(Object o) |
char[] |
get()
Return the password value if present.
|
int |
hashCode() |
boolean |
isPresent()
Return
true if there is a password present, otherwise false . |
<R> Optional<R> |
map(Function<char[],R> mapper)
|
static RedisPassword |
none()
Create an absent
RedisPassword . |
static RedisPassword |
of(char[] passwordAsChars)
Create a
RedisPassword from a char array. |
static RedisPassword |
of(String passwordAsString)
Create a
RedisPassword from a String . |
Optional<char[]> |
toOptional()
Adopt the password to
Optional containing the password value. |
String |
toString() |
public static RedisPassword of(@Nullable String passwordAsString)
RedisPassword
from a String
.passwordAsString
- the password as string.RedisPassword
for passwordAsString
.public static RedisPassword of(@Nullable char[] passwordAsChars)
RedisPassword
from a char
array.passwordAsChars
- the password as char array.RedisPassword
for passwordAsChars
.public static RedisPassword none()
RedisPassword
.RedisPassword
.public boolean isPresent()
true
if there is a password present, otherwise false
.true
if there is a password present, otherwise false
public char[] get() throws NoSuchElementException
NoSuchElementException
if the password is absent.NoSuchElementException
- if the password is absent.public <R> Optional<R> map(Function<char[],R> mapper)
Function
and return a Optional
containing the mapped value.
Absent passwords return a Optional.empty()
.
mapper
- must not be null.public Optional<char[]> toOptional()
Optional
containing the password value.
Absent passwords return a Optional.empty()
.
Optional
containing the password value.Copyright © 2011–2023 Pivotal Software, Inc.. All rights reserved.