Class BindResult<T>
java.lang.Object
org.springframework.boot.context.properties.bind.BindResult<T>
- Type Parameters:
T- the result type
-
Method Summary
Modifier and TypeMethodDescriptionbooleanget()Return the object that was bound or throw aNoSuchElementExceptionif no value was bound.inthashCode()voidInvoke the specified consumer with the bound value, or do nothing if no value has been bound.booleanisBound()Returnstrueif a result was bound.<U> BindResult<U> Apply the provided mapping function to the bound value, or return an updated unbound result if no value has been bound.@Nullable TReturn the object that was bound, orotherif no value has been bound.Return the object that was bound, or the result of invokingotherif no value has been bound.orElseThrow(Supplier<? extends X> exceptionSupplier) Return the object that was bound, or throw an exception to be created by the provided supplier if no value has been bound.
-
Method Details
-
get
Return the object that was bound or throw aNoSuchElementExceptionif no value was bound.- Returns:
- the bound value (never
null) - Throws:
NoSuchElementException- if no value was bound- See Also:
-
isBound
public boolean isBound()Returnstrueif a result was bound.- Returns:
- if a result was bound
-
ifBound
-
map
Apply the provided mapping function to the bound value, or return an updated unbound result if no value has been bound.- Type Parameters:
U- the type of the result of the mapping function- Parameters:
mapper- a mapping function to apply to the bound value. The mapper will not be invoked if no value has been bound.- Returns:
- an
BindResultdescribing the result of applying a mapping function to the value of thisBindResult.
-
orElse
-
orElseGet
-
orElseThrow
Return the object that was bound, or throw an exception to be created by the provided supplier if no value has been bound.- Type Parameters:
X- the type of the exception to be thrown- Parameters:
exceptionSupplier- the supplier which will return the exception to be thrown- Returns:
- the present value
- Throws:
X- if there is no value present
-
equals
-
hashCode
-