T - the source typepublic final class Bindable<T>
extends java.lang.Object
Binder.of(Class),
of(ResolvableType)| Modifier and Type | Class and Description |
|---|---|
static class |
Bindable.BindRestriction
Restrictions that can be applied when binding values.
|
| Modifier and Type | Method and Description |
|---|---|
boolean |
equals(java.lang.Object obj) |
<A extends java.lang.annotation.Annotation> |
getAnnotation(java.lang.Class<A> type)
Return a single associated annotations that could affect binding.
|
java.lang.annotation.Annotation[] |
getAnnotations()
Return any associated annotations that could affect binding.
|
org.springframework.core.ResolvableType |
getBoxedType()
Return the boxed type of the item to bind.
|
org.springframework.core.ResolvableType |
getType()
Return the type of the item to bind.
|
java.util.function.Supplier<T> |
getValue()
Return a supplier that provides the object value or
null. |
boolean |
hasBindRestriction(Bindable.BindRestriction bindRestriction)
Returns
true if the specified bind restriction has been added. |
int |
hashCode() |
static <E> Bindable<java.util.List<E>> |
listOf(java.lang.Class<E> elementType)
Create a new
Bindable List of the specified element type. |
static <K,V> Bindable<java.util.Map<K,V>> |
mapOf(java.lang.Class<K> keyType,
java.lang.Class<V> valueType)
Create a new
Bindable Map of the specified key and value type. |
static <T> Bindable<T> |
of(java.lang.Class<T> type)
Create a new
Bindable of the specified type. |
static <T> Bindable<T> |
of(org.springframework.core.ResolvableType type)
Create a new
Bindable of the specified type. |
static <T> Bindable<T> |
ofInstance(T instance)
Create a new
Bindable of the type of the specified instance with an
existing value equal to the instance. |
static <E> Bindable<java.util.Set<E>> |
setOf(java.lang.Class<E> elementType)
Create a new
Bindable Set of the specified element type. |
java.lang.String |
toString() |
Bindable<T> |
withAnnotations(java.lang.annotation.Annotation... annotations)
Create an updated
Bindable instance with the specified annotations. |
Bindable<T> |
withBindRestrictions(Bindable.BindRestriction... additionalRestrictions)
Create an updated
Bindable instance with additional bind restrictions. |
Bindable<T> |
withExistingValue(T existingValue)
Create an updated
Bindable instance with an existing value. |
Bindable<T> |
withSuppliedValue(java.util.function.Supplier<T> suppliedValue)
Create an updated
Bindable instance with a value supplier. |
public org.springframework.core.ResolvableType getType()
public org.springframework.core.ResolvableType getBoxedType()
public java.util.function.Supplier<T> getValue()
null.nullpublic java.lang.annotation.Annotation[] getAnnotations()
public <A extends java.lang.annotation.Annotation> A getAnnotation(java.lang.Class<A> type)
A - the annotation typetype - annotation typenullpublic boolean hasBindRestriction(Bindable.BindRestriction bindRestriction)
true if the specified bind restriction has been added.bindRestriction - the bind restriction to checkpublic boolean equals(java.lang.Object obj)
equals in class java.lang.Objectpublic int hashCode()
hashCode in class java.lang.Objectpublic java.lang.String toString()
toString in class java.lang.Objectpublic Bindable<T> withAnnotations(java.lang.annotation.Annotation... annotations)
Bindable instance with the specified annotations.annotations - the annotationsBindablepublic Bindable<T> withExistingValue(T existingValue)
Bindable instance with an existing value.existingValue - the existing valueBindablepublic Bindable<T> withSuppliedValue(java.util.function.Supplier<T> suppliedValue)
Bindable instance with a value supplier.suppliedValue - the supplier for the valueBindablepublic Bindable<T> withBindRestrictions(Bindable.BindRestriction... additionalRestrictions)
Bindable instance with additional bind restrictions.additionalRestrictions - any additional restrictions to applyBindablepublic static <T> Bindable<T> ofInstance(T instance)
Bindable of the type of the specified instance with an
existing value equal to the instance.T - the source typeinstance - the instance (must not be null)Bindable instanceof(ResolvableType),
withExistingValue(Object)public static <T> Bindable<T> of(java.lang.Class<T> type)
Bindable of the specified type.T - the source typetype - the type (must not be null)Bindable instanceof(ResolvableType)public static <E> Bindable<java.util.List<E>> listOf(java.lang.Class<E> elementType)
Bindable List of the specified element type.E - the element typeelementType - the list element typeBindable instancepublic static <E> Bindable<java.util.Set<E>> setOf(java.lang.Class<E> elementType)
Bindable Set of the specified element type.E - the element typeelementType - the set element typeBindable instancepublic static <K,V> Bindable<java.util.Map<K,V>> mapOf(java.lang.Class<K> keyType, java.lang.Class<V> valueType)
Bindable Map of the specified key and value type.K - the key typeV - the value typekeyType - the map key typevalueType - the map value typeBindable instance