Class Bindable<T>
java.lang.Object
org.springframework.boot.context.properties.bind.Bindable<T>
- Type Parameters:
T- the source type
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionstatic enumRestrictions that can be applied when binding values. -
Method Summary
Modifier and TypeMethodDescriptionboolean<A extends Annotation>
@Nullable AgetAnnotation(Class<A> type) Return a single associated annotations that could affect binding.Return any associated annotations that could affect binding.@Nullable BindMethodReturns themethodto be used to bind this bindable, ornullif no specific binding method is required.org.springframework.core.ResolvableTypeReturn the boxed type of the item to bind.org.springframework.core.ResolvableTypegetType()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(org.springframework.core.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 @Nullable ... annotations) Create an updatedBindableinstance with the specified annotations.withBindMethod(@Nullable BindMethod bindMethod) Create an updatedBindableinstance with a specific bind method.withBindRestrictions(Bindable.BindRestriction... additionalRestrictions) Create an updatedBindableinstance with additional bind restrictions.withExistingValue(@Nullable T existingValue) Create an updatedBindableinstance with an existing value.withSuppliedValue(@Nullable Supplier<T> suppliedValue) Create an updatedBindableinstance with a value supplier.
-
Method Details
-
getType
public org.springframework.core.ResolvableType getType()Return the type of the item to bind.- Returns:
- the type being bound
-
getBoxedType
public org.springframework.core.ResolvableType getBoxedType()Return the boxed type of the item to bind.- Returns:
- the boxed type for the item being bound
-
getValue
-
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
-
toString
-
withAnnotations
-
withExistingValue
-
withSuppliedValue
-
withBindRestrictions
-
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
-
of
-
listOf
-
setOf
-
mapOf
-
of
-