Annotation Type ConfigurationBuilder


  • @Documented
    @Retention(RUNTIME)
    @Target({FIELD,METHOD})
    public @interface ConfigurationBuilder

    An annotation applicable to a field or method of a ConfigurationProperties instance that allows to customize the behaviour of properties that are builders themselves.

    Since:
    1.0
    • Optional Element Summary

      Optional Elements 
      Modifier and Type Optional Element Description
      boolean allowZeroArgs
      Some APIs allow zero argument setters to set boolean flags such as setDebug().
      java.lang.String[] children  
      java.lang.String configurationPrefix
      When this annotation is used, by default the name of the field or method is not taken into account when retrieving configuration properties.
      java.lang.String[] excludes  
      java.lang.String factoryMethod
      Only to be used if the builder is not being created manually.
      java.lang.String[] includes  
      java.lang.String[] prefixes
      The default is for ConfigurationBuilder to look for public JavaBean-style setters.
      java.lang.String value  
    • Element Detail

      • value

        java.lang.String value
        Returns:
        The configuration prefix
        See Also:
        configurationPrefix()
        Default:
        ""
      • prefixes

        @AliasFor(annotation=io.micronaut.core.annotation.AccessorsStyle.class,
                  member="writePrefixes")
        java.lang.String[] prefixes

        The default is for ConfigurationBuilder to look for public JavaBean-style setters. Many APIs however use a builder-style or other style to for constructing configuration.

        This method allows overriding this behaviour. For example if the builder you are authoring for prefixes write operations with the word "with" by setting the value of this attribute to "with" you can process methods such as withDebug(true)

        Returns:
        The write prefixes to use
        Default:
        {"set"}
      • configurationPrefix

        @AliasFor(member="value")
        java.lang.String configurationPrefix

        When this annotation is used, by default the name of the field or method is not taken into account when retrieving configuration properties.

        This method allows overriding this behaviour. For example if the annotation is placed on a field, you can change the prefix for which configuration values will be searched to populate the field.

        Returns:
        The configuration prefix to use
        Default:
        ""
      • allowZeroArgs

        boolean allowZeroArgs

        Some APIs allow zero argument setters to set boolean flags such as setDebug(). These by default are not processed unless the value of this annotation is set to true.

        Note that this attribute works in conjunction with prefixes() to allow other styles such as withDebug()

        Returns:
        True if zero arg setters should be processed
        Default:
        false
      • factoryMethod

        java.lang.String factoryMethod
        Only to be used if the builder is not being created manually.
        Returns:
        The name of a static factory method used to create the builder
        Default:
        ""
      • children

        java.lang.String[] children
        Returns:
        The names of the properties that are child builders
        Default:
        {}
      • includes

        java.lang.String[] includes
        Returns:
        The names of the properties to include
        Default:
        {}
      • excludes

        java.lang.String[] excludes
        Returns:
        The names of the properties to exclude
        Default:
        {}