Class ConfigurationMetadataBuilder

java.lang.Object
io.micronaut.inject.configuration.ConfigurationMetadataBuilder

public class ConfigurationMetadataBuilder extends Object

A builder for producing metadata for the available ConfigurationProperties.

This data can then be subsequently written to a format readable by IDEs (like spring-configuration-metadata.json for example).

Since:
1.0
Author:
Graeme Rocher, Denis Stepanov
  • Field Details

  • Constructor Details

    • ConfigurationMetadataBuilder

      public ConfigurationMetadataBuilder()
  • Method Details

    • getOriginatingElements

      public @NonNull Element[] getOriginatingElements()
      Returns:
      The originating elements for the builder.
    • getProperties

      public List<PropertyMetadata> getProperties()
      Returns:
      The properties
    • getConfigurations

      public List<ConfigurationMetadata> getConfigurations()
      Returns:
      The configurations
    • hasMetadata

      public boolean hasMetadata()
      Returns:
      Whether any metadata is present
    • visitProperties

      public ConfigurationMetadata visitProperties(ClassElement classElement)
      Parameters:
      classElement - The type of the ConfigurationProperties
      Returns:
      This ConfigurationMetadata
    • visitBuilder

      public ConfigurationMetadata visitBuilder(String prefix, MemberElement builderElement, ClassElement builderType)
      Visit a ConfigurationBuilder build element.
      Parameters:
      prefix - The prefix
      builderElement - The builder element
      builderType - The type of the ConfigurationBuilder
      Returns:
      This ConfigurationMetadata
    • visitProperty

      public PropertyMetadata visitProperty(ClassElement owningType, ClassElement declaringType, ClassElement propertyType, String name, @Nullable String description, @Nullable String defaultValue)
      Visit a configuration property.
      Parameters:
      owningType - The type that owns the property
      declaringType - The declaring type of the property
      propertyType - The property type
      name - The property name
      description - A description for the property
      defaultValue - The default value of the property (only used for constant values such as strings, numbers, enums etc.)
      Returns:
      This property metadata
    • visitProperty

      public PropertyMetadata visitProperty(ClassElement owningType, ClassElement declaringType, ClassElement propertyType, String name, String path, @Nullable String description, @Nullable String defaultValue)
      Visit a configuration property.
      Parameters:
      owningType - The type that owns the property
      declaringType - The declaring type of the property
      propertyType - The property type
      name - The property name
      path - The property path
      description - A description for the property
      defaultValue - The default value of the property (only used for constant values such as strings, numbers, enums etc.)
      Returns:
      This property metadata
    • calculatePath

      public static String calculatePath(ClassElement owningType, ClassElement declaringType, ClassElement propertyType, String name)
      Calculate the path.
      Parameters:
      owningType - The type that owns the property
      declaringType - The declaring type of the property
      propertyType - The property type
      name - The property name enums etc.)
      Returns:
      This property metadata
    • reset

      @Internal public static void reset()
      Reset the state.