Package io.micronaut.views.fields
Class DefaultFieldGenerator
java.lang.Object
io.micronaut.views.fields.DefaultFieldGenerator
- All Implemented Interfaces:
FieldsetGenerator
Default implementation of
FieldsetGenerator
which relies on the types being introspected.- Since:
- 4.1.0
- Author:
- Sergio del Amo
-
Constructor Summary
ConstructorDescriptionDefaultFieldGenerator
(EnumOptionFetcher<?> enumOptionFetcher, EnumRadioFetcher<?> enumRadioFetcher, EnumCheckboxFetcher<?> enumCheckboxFetcher, io.micronaut.context.BeanContext beanContext, FormElementResolver formElementResolver) -
Method Summary
Modifier and TypeMethodDescription<T> @NonNull Fieldset
<T> Fieldset
generate
(@NonNull Class<T> type, @NonNull BiConsumer<String, io.micronaut.core.beans.BeanIntrospection.Builder<? extends FormElement>> builderConsumer) @NonNull Fieldset
generate
(@NonNull Object instance, @NonNull BiConsumer<String, io.micronaut.core.beans.BeanIntrospection.Builder<? extends FormElement>> builderConsumer) generate
(Object instance, jakarta.validation.ConstraintViolationException ex, BiConsumer<String, io.micronaut.core.beans.BeanIntrospection.Builder<? extends FormElement>> builderConsumer)
-
Constructor Details
-
DefaultFieldGenerator
public DefaultFieldGenerator(EnumOptionFetcher<?> enumOptionFetcher, EnumRadioFetcher<?> enumRadioFetcher, EnumCheckboxFetcher<?> enumCheckboxFetcher, io.micronaut.context.BeanContext beanContext, FormElementResolver formElementResolver) - Parameters:
enumOptionFetcher
- Enum fetcher forOption
.enumRadioFetcher
- Enum fetcher forRadio
.enumCheckboxFetcher
- Enum fetcher forCheckbox
.beanContext
- Bean ContextformElementResolver
- Primary Form Element Resolver.CompositeFormElementResolver
.
-
-
Method Details
-
generate
- Specified by:
generate
in interfaceFieldsetGenerator
- Type Parameters:
T
- type- Parameters:
type
- A class which should beIntrospected
.- Returns:
- A Fieldset
-
generate
public <T> Fieldset generate(@NonNull @NonNull Class<T> type, @NonNull @NonNull BiConsumer<String, io.micronaut.core.beans.BeanIntrospection.Builder<? extends FormElement>> builderConsumer) - Specified by:
generate
in interfaceFieldsetGenerator
- Type Parameters:
T
- type- Parameters:
type
- A class which should beIntrospected
.builderConsumer
- A biconsumer with the property name and the builder- Returns:
- A Fieldset
-
generate
- Specified by:
generate
in interfaceFieldsetGenerator
- Parameters:
instance
- The Object instance which should beIntrospected
.- Returns:
- A Fieldset
-
generate
@NonNull public @NonNull Fieldset generate(@NonNull @NonNull Object instance, @NonNull @NonNull BiConsumer<String, io.micronaut.core.beans.BeanIntrospection.Builder<? extends FormElement>> builderConsumer) - Specified by:
generate
in interfaceFieldsetGenerator
- Parameters:
instance
- The Object instance which should beIntrospected
.builderConsumer
- A biconsumer with the property name and the builder- Returns:
- A Fieldset
-
generate
public Fieldset generate(@NonNull @NonNull Object instance, @NonNull @NonNull jakarta.validation.ConstraintViolationException ex) - Specified by:
generate
in interfaceFieldsetGenerator
- Parameters:
instance
- The Object instance which should beIntrospected
.ex
- A Validation exception- Returns:
- A Fieldset
-
generate
public Fieldset generate(Object instance, jakarta.validation.ConstraintViolationException ex, BiConsumer<String, io.micronaut.core.beans.BeanIntrospection.Builder<? extends FormElement>> builderConsumer) - Specified by:
generate
in interfaceFieldsetGenerator
- Parameters:
instance
- The Object instance which should beIntrospected
.ex
- A Validation exceptionbuilderConsumer
- A biconsumer with the property name and the builder- Returns:
- A Fieldset
-