Class Bindable<T>
java.lang.Object
org.springframework.boot.context.properties.bind.Bindable<T>
- Type Parameters:
T- the source type
Source that can be bound by a
Binder.- Since:
- 2.0.0
- Author:
- Phillip Webb, Madhura Bhave
- See Also:
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionstatic enumRestrictions that can be applied when binding values. -
Method Summary
Modifier and TypeMethodDescriptionboolean<A extends Annotation>
AgetAnnotation(Class<A> type) Return a single associated annotations that could affect binding.Return any associated annotations that could affect binding.Returns themethodto be used to bind this bindable, ornullif no specific binding method is required.Return the boxed type of the item to bind.getType()Return the type of the item to bind.getValue()Return a supplier that provides the object value ornull.booleanhasBindRestriction(Bindable.BindRestriction bindRestriction) Returnstrueif the specified bind restriction has been added.inthashCode()static <T> Bindable<T>Create a newBindableof the specified type.static <T> Bindable<T>of(ResolvableType type) Create a newBindableof the specified type.static <T> Bindable<T>ofInstance(T instance) Create a newBindableof the type of the specified instance with an existing value equal to the instance.toString()withAnnotations(Annotation... annotations) Create an updatedBindableinstance with the specified annotations.withBindMethod(BindMethod bindMethod) Create an updatedBindableinstance with a specific bind method.withBindRestrictions(Bindable.BindRestriction... additionalRestrictions) Create an updatedBindableinstance with additional bind restrictions.withExistingValue(T existingValue) Create an updatedBindableinstance with an existing value.withSuppliedValue(Supplier<T> suppliedValue) Create an updatedBindableinstance with a value supplier.
-
Method Details
-
getType
Return the type of the item to bind.- Returns:
- the type being bound
-
getBoxedType
Return the boxed type of the item to bind.- Returns:
- the boxed type for the item being bound
-
getValue
Return a supplier that provides the object value ornull.- Returns:
- the value or
null
-
getAnnotations
Return any associated annotations that could affect binding.- Returns:
- the associated annotations
-
getAnnotation
Return a single associated annotations that could affect binding.- Type Parameters:
A- the annotation type- Parameters:
type- annotation type- Returns:
- the associated annotation or
null
-
hasBindRestriction
Returnstrueif the specified bind restriction has been added.- Parameters:
bindRestriction- the bind restriction to check- Returns:
- if the bind restriction has been added
- Since:
- 2.5.0
-
getBindMethod
Returns themethodto be used to bind this bindable, ornullif no specific binding method is required.- Returns:
- the bind method or
null - Since:
- 3.0.8
-
equals
-
hashCode
public int hashCode() -
toString
-
withAnnotations
Create an updatedBindableinstance with the specified annotations.- Parameters:
annotations- the annotations- Returns:
- an updated
Bindable
-
withExistingValue
Create an updatedBindableinstance with an existing value. Implies that Java Bean binding will be used.- Parameters:
existingValue- the existing value- Returns:
- an updated
Bindable
-
withSuppliedValue
Create an updatedBindableinstance with a value supplier.- Parameters:
suppliedValue- the supplier for the value- Returns:
- an updated
Bindable
-
withBindRestrictions
Create an updatedBindableinstance with additional bind restrictions.- Parameters:
additionalRestrictions- any additional restrictions to apply- Returns:
- an updated
Bindable - Since:
- 2.5.0
-
withBindMethod
Create an updatedBindableinstance with a specific bind method. To usevalue object binding, the current instance must not have an existing or supplied value.- Parameters:
bindMethod- the method to use to bind the bindable- Returns:
- an updated
Bindable - Since:
- 3.0.8
-
ofInstance
Create a newBindableof the type of the specified instance with an existing value equal to the instance.- Type Parameters:
T- the source type- Parameters:
instance- the instance (must not benull)- Returns:
- a
Bindableinstance - See Also:
-
of
Create a newBindableof the specified type.- Type Parameters:
T- the source type- Parameters:
type- the type (must not benull)- Returns:
- a
Bindableinstance - See Also:
-
listOf
- Type Parameters:
E- the element type- Parameters:
elementType- the list element type- Returns:
- a
Bindableinstance
-
setOf
- Type Parameters:
E- the element type- Parameters:
elementType- the set element type- Returns:
- a
Bindableinstance
-
mapOf
- Type Parameters:
K- the key typeV- the value type- Parameters:
keyType- the map key typevalueType- the map value type- Returns:
- a
Bindableinstance
-
of
Create a newBindableof the specified type.
-