Class RedisPassword
java.lang.Object
org.springframework.data.redis.connection.RedisPassword
Value object which may or may not contain a Redis 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, Yong-Hyun Kim
- 
Method SummaryModifier and TypeMethodDescriptionbooleanchar[]get()Return the password value if present.inthashCode()booleanReturntrueif there is a password present, otherwisefalse.<R> Optional<R>static RedisPasswordnone()Create an absentRedisPassword.static RedisPasswordof(char[] passwordAsChars) Create aRedisPasswordfrom achararray.static RedisPasswordCreate aRedisPasswordfrom aString.Optional<char[]>Adopt the password toOptionalcontaining the password value.toString()
- 
Method Details- 
ofCreate aRedisPasswordfrom aString.- Parameters:
- passwordAsString- the password as string.
- Returns:
- the RedisPasswordforpasswordAsString.
 
- 
ofCreate aRedisPasswordfrom achararray.- Parameters:
- passwordAsChars- the password as char array.
- Returns:
- the RedisPasswordforpasswordAsChars.
 
- 
noneCreate an absentRedisPassword.- Returns:
- the absent RedisPassword.
 
- 
isPresentpublic boolean isPresent()Returntrueif there is a password present, otherwisefalse.- Returns:
- trueif there is a password present, otherwise- false
 
- 
getReturn the password value if present. ThrowsNoSuchElementExceptionif the password is absent.- Returns:
- the password.
- Throws:
- NoSuchElementException- if the password is absent.
 
- 
mapMap 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.
 
- 
toOptionalAdopt the password toOptionalcontaining the password value.Absent passwords return a Optional.empty().- Returns:
- the Optionalcontaining the password value.
 
- 
equals
- 
hashCodepublic int hashCode()
- 
toString
 
-