类 Bindable<T>
java.lang.Object
org.springframework.boot.context.properties.bind.Bindable<T>
- 类型参数:
T
- the source type
Source that can be bound by a
Binder
.- 从以下版本开始:
- 2.0.0
- 作者:
- Phillip Webb, Madhura Bhave
- 另请参阅:
-
嵌套类概要
嵌套类修饰符和类型类说明static enum
Restrictions that can be applied when binding values. -
方法概要
修饰符和类型方法说明boolean
<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 themethod
to be used to bind this bindable, ornull
if 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
.boolean
hasBindRestriction
(Bindable.BindRestriction bindRestriction) Returnstrue
if the specified bind restriction has been added.int
hashCode()
static <T> Bindable
<T> Create a newBindable
of the specified type.static <T> Bindable
<T> of
(ResolvableType type) Create a newBindable
of the specified type.static <T> Bindable
<T> ofInstance
(T instance) Create a newBindable
of the type of the specified instance with an existing value equal to the instance.toString()
withAnnotations
(Annotation... annotations) Create an updatedBindable
instance with the specified annotations.withBindMethod
(BindMethod bindMethod) Create an updatedBindable
instance with a specific bind method.withBindRestrictions
(Bindable.BindRestriction... additionalRestrictions) Create an updatedBindable
instance with additional bind restrictions.withExistingValue
(T existingValue) Create an updatedBindable
instance with an existing value.withSuppliedValue
(Supplier<T> suppliedValue) Create an updatedBindable
instance with a value supplier.
-
方法详细资料
-
getType
Return the type of the item to bind.- 返回:
- the type being bound
-
getBoxedType
Return the boxed type of the item to bind.- 返回:
- the boxed type for the item being bound
-
getValue
Return a supplier that provides the object value ornull
.- 返回:
- the value or
null
-
getAnnotations
Return any associated annotations that could affect binding.- 返回:
- the associated annotations
-
getAnnotation
Return a single associated annotations that could affect binding.- 类型参数:
A
- the annotation type- 参数:
type
- annotation type- 返回:
- the associated annotation or
null
-
hasBindRestriction
Returnstrue
if the specified bind restriction has been added.- 参数:
bindRestriction
- the bind restriction to check- 返回:
- if the bind restriction has been added
- 从以下版本开始:
- 2.5.0
-
getBindMethod
Returns themethod
to be used to bind this bindable, ornull
if no specific binding method is required.- 返回:
- the bind method or
null
- 从以下版本开始:
- 3.0.8
-
equals
-
hashCode
public int hashCode() -
toString
-
withAnnotations
Create an updatedBindable
instance with the specified annotations.- 参数:
annotations
- the annotations- 返回:
- an updated
Bindable
-
withExistingValue
Create an updatedBindable
instance with an existing value. Implies that Java Bean binding will be used.- 参数:
existingValue
- the existing value- 返回:
- an updated
Bindable
-
withSuppliedValue
Create an updatedBindable
instance with a value supplier.- 参数:
suppliedValue
- the supplier for the value- 返回:
- an updated
Bindable
-
withBindRestrictions
Create an updatedBindable
instance with additional bind restrictions.- 参数:
additionalRestrictions
- any additional restrictions to apply- 返回:
- an updated
Bindable
- 从以下版本开始:
- 2.5.0
-
withBindMethod
Create an updatedBindable
instance with a specific bind method. To usevalue object binding
, the current instance must not have an existing or supplied value.- 参数:
bindMethod
- the method to use to bind the bindable- 返回:
- an updated
Bindable
- 从以下版本开始:
- 3.0.8
-
ofInstance
Create a newBindable
of the type of the specified instance with an existing value equal to the instance.- 类型参数:
T
- the source type- 参数:
instance
- the instance (must not benull
)- 返回:
- a
Bindable
instance - 另请参阅:
-
of
Create a newBindable
of the specified type.- 类型参数:
T
- the source type- 参数:
type
- the type (must not benull
)- 返回:
- a
Bindable
instance - 另请参阅:
-
listOf
- 类型参数:
E
- the element type- 参数:
elementType
- the list element type- 返回:
- a
Bindable
instance
-
setOf
- 类型参数:
E
- the element type- 参数:
elementType
- the set element type- 返回:
- a
Bindable
instance
-
mapOf
- 类型参数:
K
- the key typeV
- the value type- 参数:
keyType
- the map key typevalueType
- the map value type- 返回:
- a
Bindable
instance
-
of
Create a newBindable
of the specified type.- 类型参数:
T
- the source type- 参数:
type
- the type (must not benull
)- 返回:
- a
Bindable
instance - 另请参阅:
-