T
- the source typepublic final class Bindable<T> extends Object
Binder
.of(Class)
,
of(ResolvableType)
Modifier and Type | Method and Description |
---|---|
boolean |
equals(Object obj) |
<A extends Annotation> |
getAnnotation(Class<A> type)
Return a single associated annotations that could affect binding.
|
Annotation[] |
getAnnotations()
Return any associated annotations that could affect binding.
|
Object |
getAttribute(String name)
Return the value of an attribute that has been associated with this
Bindable . |
ResolvableType |
getBoxedType()
Return the boxed type of the item to bind.
|
ResolvableType |
getType()
Return the type of the item to bind.
|
Supplier<T> |
getValue()
Return a supplier that provides the object value or
null . |
int |
hashCode() |
static <E> Bindable<List<E>> |
listOf(Class<E> elementType)
|
static <K,V> Bindable<Map<K,V>> |
mapOf(Class<K> keyType,
Class<V> valueType)
|
static <T> Bindable<T> |
of(Class<T> type)
Create a new
Bindable of the specified type. |
static <T> Bindable<T> |
of(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<Set<E>> |
setOf(Class<E> elementType)
|
String |
toString() |
Bindable<T> |
withAnnotations(Annotation... annotations)
Create an updated
Bindable instance with the specified annotations. |
Bindable<T> |
withAttribute(String name,
Object value)
Create an updated
Bindable instance with the specified attribute. |
Bindable<T> |
withExistingValue(T existingValue)
Create an updated
Bindable instance with an existing value. |
Bindable<T> |
withSuppliedValue(Supplier<T> suppliedValue)
Create an updated
Bindable instance with a value supplier. |
public ResolvableType getType()
public ResolvableType getBoxedType()
public Supplier<T> getValue()
null
.null
public Annotation[] getAnnotations()
public <A extends Annotation> A getAnnotation(Class<A> type)
A
- the annotation typetype
- annotation typenull
public Object getAttribute(String name)
Bindable
.name
- the attribute namenull
public Bindable<T> withAnnotations(Annotation... annotations)
Bindable
instance with the specified annotations.annotations
- the annotationsBindable
public Bindable<T> withAttribute(String name, Object value)
Bindable
instance with the specified attribute.name
- the attribute namevalue
- the attribute valueBindable
public Bindable<T> withExistingValue(T existingValue)
Bindable
instance with an existing value.existingValue
- the existing valueBindable
public Bindable<T> withSuppliedValue(Supplier<T> suppliedValue)
Bindable
instance with a value supplier.suppliedValue
- the supplier for the valueBindable
public 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(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<List<E>> listOf(Class<E> elementType)
E
- the element typeelementType
- the list element typeBindable
instancepublic static <E> Bindable<Set<E>> setOf(Class<E> elementType)
E
- the element typeelementType
- the set element typeBindable
instancepublic static <K,V> Bindable<Map<K,V>> mapOf(Class<K> keyType, Class<V> valueType)
K
- the key typeV
- the value typekeyType
- the map key typevalueType
- the map value typeBindable
instancepublic static <T> Bindable<T> of(ResolvableType type)
Bindable
of the specified type.