Class CompositeFormElementResolver
java.lang.Object
io.micronaut.views.fields.formelementresolvers.CompositeFormElementResolver
- All Implemented Interfaces:
io.micronaut.core.order.Ordered
,FormElementResolver
@Primary
@Singleton
@Internal
public class CompositeFormElementResolver
extends Object
implements FormElementResolver
Composite Pattern implementaiton for the
FormElementResolver
API.
This instance is injected when injecting a single bean of type FormElementResolver
because of the Primary
annotation.
This implementation iterates through every bean of type FormElementResolver
in order and returns the first resolved FormElement
class if any.- Since:
- 5.1.0
- Author:
- Sergio del Amo
-
Field Summary
Fields inherited from interface io.micronaut.core.order.Ordered
HIGHEST_PRECEDENCE, LOWEST_PRECEDENCE
-
Constructor Summary
ConstructorDescriptionCompositeFormElementResolver
(List<FormElementResolver> formElementResolvers) -
Method Summary
Modifier and TypeMethodDescriptionint
getOrder()
<B,
T> Optional<Class<? extends FormElement>> resolve
(io.micronaut.core.beans.BeanProperty<B, T> beanProperty) Resolves given a bean property theFormElement
class which should be used to be build the element.
-
Constructor Details
-
CompositeFormElementResolver
- Parameters:
formElementResolvers
- Beans of typeFormElementResolver
in order.
-
-
Method Details
-
resolve
public <B,T> Optional<Class<? extends FormElement>> resolve(io.micronaut.core.beans.BeanProperty<B, T> beanProperty) Description copied from interface:FormElementResolver
Resolves given a bean property theFormElement
class which should be used to be build the element.- Specified by:
resolve
in interfaceFormElementResolver
- Type Parameters:
B
- The bean typeT
- The bean property type- Parameters:
beanProperty
- Bean Property- Returns:
- The best Form Element for the bean property.
-
getOrder
public int getOrder()- Specified by:
getOrder
in interfaceio.micronaut.core.order.Ordered
-