Class DefaultFieldGenerator

java.lang.Object
io.micronaut.views.fields.DefaultFieldGenerator
All Implemented Interfaces:
FieldsetGenerator

@Internal @Singleton public class DefaultFieldGenerator extends Object implements FieldsetGenerator
Default implementation of FieldsetGenerator which relies on the types being introspected.
Since:
4.1.0
Author:
Sergio del Amo
  • Constructor Details

    • DefaultFieldGenerator

      public DefaultFieldGenerator(EnumOptionFetcher<?> enumOptionFetcher, EnumRadioFetcher<?> enumRadioFetcher, EnumCheckboxFetcher<?> enumCheckboxFetcher, io.micronaut.context.BeanContext beanContext)
      Parameters:
      enumOptionFetcher - Enum fetcher for Option.
      enumRadioFetcher - Enum fetcher for Radio.
      enumCheckboxFetcher - Enum fetcher for Checkbox.
      beanContext - Bean Context
  • Method Details

    • generate

      @NonNull public <T> @NonNull Fieldset generate(@NonNull @NonNull Class<T> type)
      Specified by:
      generate in interface FieldsetGenerator
      Type Parameters:
      T - type
      Parameters:
      type - A class which should be Introspected.
      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 interface FieldsetGenerator
      Type Parameters:
      T - type
      Parameters:
      type - A class which should be Introspected.
      builderConsumer - A biconsumer with the property name and the builder
      Returns:
      A Fieldset
    • generate

      public Fieldset generate(@NonNull @NonNull Object instance)
      Specified by:
      generate in interface FieldsetGenerator
      Parameters:
      instance - The Object instance which should be Introspected.
      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 interface FieldsetGenerator
      Parameters:
      instance - The Object instance which should be Introspected.
      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 interface FieldsetGenerator
      Parameters:
      instance - The Object instance which should be Introspected.
      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 interface FieldsetGenerator
      Parameters:
      instance - The Object instance which should be Introspected.
      ex - A Validation exception
      builderConsumer - A biconsumer with the property name and the builder
      Returns:
      A Fieldset