Class ConfigurationMetadataBuilder
java.lang.Object
io.micronaut.inject.configuration.ConfigurationMetadataBuilder
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 Summary
FieldsModifier and TypeFieldDescriptionstatic final ConfigurationMetadataBuilder
Deprecated, for removal: This API element is subject to removal in a future version.Should not be used with the static state -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionstatic String
calculatePath
(ClassElement owningType, ClassElement declaringType, ClassElement propertyType, String name) Calculate the path.boolean
static void
reset()
Reset the state.visitBuilder
(String prefix, MemberElement builderElement, ClassElement builderType) Visit aConfigurationBuilder
build element.visitProperties
(ClassElement classElement) Visit aConfigurationProperties
class.visitProperty
(ClassElement owningType, ClassElement declaringType, ClassElement propertyType, String name, @Nullable String description, @Nullable String defaultValue) Visit a configuration property.visitProperty
(ClassElement owningType, ClassElement declaringType, ClassElement propertyType, String name, String path, @Nullable String description, @Nullable String defaultValue) Visit a configuration property.
-
Field Details
-
INSTANCE
@Deprecated(forRemoval=true, since="4.10") public static final ConfigurationMetadataBuilder INSTANCEDeprecated, for removal: This API element is subject to removal in a future version.Should not be used with the static state
-
-
Constructor Details
-
ConfigurationMetadataBuilder
public ConfigurationMetadataBuilder()
-
-
Method Details
-
getOriginatingElements
- Returns:
- The originating elements for the builder.
-
getProperties
- Returns:
- The properties
-
getConfigurations
- Returns:
- The configurations
-
hasMetadata
public boolean hasMetadata()- Returns:
- Whether any metadata is present
-
visitProperties
Visit aConfigurationProperties
class.- Parameters:
classElement
- The type of theConfigurationProperties
- Returns:
- This
ConfigurationMetadata
-
visitBuilder
public ConfigurationMetadata visitBuilder(String prefix, MemberElement builderElement, ClassElement builderType) Visit aConfigurationBuilder
build element.- Parameters:
prefix
- The prefixbuilderElement
- The builder elementbuilderType
- The type of theConfigurationBuilder
- Returns:
- This
ConfigurationMetadata
-
visitProperty
public PropertyMetadata visitProperty(ClassElement owningType, ClassElement declaringType, ClassElement propertyType, String name, @Nullable @Nullable String description, @Nullable @Nullable String defaultValue) Visit a configuration property.- Parameters:
owningType
- The type that owns the propertydeclaringType
- The declaring type of the propertypropertyType
- The property typename
- The property namedescription
- A description for the propertydefaultValue
- 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 @Nullable String description, @Nullable @Nullable String defaultValue) Visit a configuration property.- Parameters:
owningType
- The type that owns the propertydeclaringType
- The declaring type of the propertypropertyType
- The property typename
- The property namepath
- The property pathdescription
- A description for the propertydefaultValue
- 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 propertydeclaringType
- The declaring type of the propertypropertyType
- The property typename
- The property name enums etc.)- Returns:
- This property metadata
-
reset
Reset the state.
-