Interface TypedFieldProvider<T,C extends com.vaadin.flow.component.Component & com.vaadin.flow.component.HasValue<?,T>>
- Type Parameters:
T- Type of value.C- Returned component.
- Functional Interface:
- This is a functional interface and can therefore be used as the assignment target for a lambda expression or method reference.
@FunctionalInterface
public interface TypedFieldProvider<T,C extends com.vaadin.flow.component.Component & com.vaadin.flow.component.HasValue<?,T>>
Marker interface for objects that provide components based on a given value.
- Since:
- 2022-04-11
- Author:
- miki
-
Method Summary
Modifier and TypeMethodDescriptionstatic <V,W extends com.vaadin.flow.component.Component & com.vaadin.flow.component.HasValue<?, V>>
TypedFieldProvider<V,W> Produces aTypedFieldProviderfor a given type and component.provideComponent(Class<?> valueType) Produces a component for a given value.
-
Method Details
-
provideComponent
Produces a component for a given value. The returned component should be able to accept that object of the given type when itssetValue()method is called.- Parameters:
valueType- Type of the value. Nevernull.- Returns:
- Perhaps a
Component. The result will be empty when this provider cannot produce a result for a given value.
-
of
static <V,W extends com.vaadin.flow.component.Component & com.vaadin.flow.component.HasValue<?, TypedFieldProvider<V,V>> W> of(Class<V> type, com.vaadin.flow.function.SerializableSupplier<W> supplier) Produces aTypedFieldProviderfor a given type and component.- Type Parameters:
V- Value type.W- Component type.- Parameters:
type- Type to accept.supplier- Component to produce.- Returns:
- If asked type is a subtype of the given type returns the component, otherwise returns an empty optional.
-