Skip to content

io microsphere metadata DefaultConfigurationPropertyGenerator

github-actions[bot] edited this page Mar 21, 2026 · 1 revision

DefaultConfigurationPropertyGenerator

Type: Class | Module: microsphere-java-core | Package: io.microsphere.metadata | Since: 1.0.0

Source: microsphere-java-core/src/main/java/io/microsphere/metadata/DefaultConfigurationPropertyGenerator.java

Overview

The default implementation class of ConfigurationPropertyGenerator.

Example Usage

`ConfigurationProperty property = new ConfigurationProperty("server.port", Integer.class);
property.setValue(8080);
property.setDefaultValue(8080);
property.setRequired(true);
property.setDescription("The port number for the server");

ConfigurationProperty.Metadata metadata = property.getMetadata();
metadata.getSources().add("application.properties");
metadata.getTargets().add("server");
metadata.setDeclaredClass("com.example.ServerConfig");
metadata.setDeclaredField("port");
`

The JSON representation of the above ConfigurationProperty object would be:

`{
  "name": "server.port",
  "type": "java.lang.Integer",
  "value": 8080,
  "defaultValue": 8080,
  "required": true,
  "description": "The port number for the server",
  "metadata": {
    "sources": [
      "application.properties"
    ],
    "targets": [
      "server"
    ],
    "declaredClass": "com.example.ServerConfig",
    "declaredField": "port"
  `
}
}

Declaration

public class DefaultConfigurationPropertyGenerator implements ConfigurationPropertyGenerator

Author: Mercy

Version Information

  • Introduced in: 1.0.0
  • Current Project Version: 0.1.10-SNAPSHOT

Version Compatibility

This component is tested and compatible with the following Java versions:

Java Version Status
Java 8 ✅ Compatible
Java 11 ✅ Compatible
Java 17 ✅ Compatible
Java 21 ✅ Compatible
Java 25 ✅ Compatible

Examples

Example 1

ConfigurationProperty property = new ConfigurationProperty("server.port", Integer.class);
property.setValue(8080);
property.setDefaultValue(8080);
property.setRequired(true);
property.setDescription("The port number for the server");

ConfigurationProperty.Metadata metadata = property.getMetadata();
metadata.getSources().add("application.properties");
metadata.getTargets().add("server");
metadata.setDeclaredClass("com.example.ServerConfig");
metadata.setDeclaredField("port");

Example 2

{
  "name": "server.port",
  "type": "java.lang.Integer",
  "value": 8080,
  "defaultValue": 8080,
  "required": true,
  "description": "The port number for the server",
  "metadata": {
    "sources": [
      "application.properties"
    ],
    "targets": [
      "server"
    ],
    "declaredClass": "com.example.ServerConfig",
    "declaredField": "port"
  }
}

Usage

Maven Dependency

Add the following dependency to your pom.xml:

<dependency>
    <groupId>io.github.microsphere-projects</groupId>
    <artifactId>microsphere-java-core</artifactId>
    <version>${microsphere-java.version}</version>
</dependency>

Tip: Use the BOM (microsphere-java-dependencies) for consistent version management. See the Getting Started guide.

Import

import io.microsphere.metadata.DefaultConfigurationPropertyGenerator;

API Reference

Public Methods

Method Description
generate
getPriority

See Also

  • ConfigurationPropertyGenerator
  • ConfigurationProperty

This documentation was auto-generated from the source code of microsphere-java.

Home

java-annotations

java-core

jdk-tools

lang-model

annotation-processor

java-test

Clone this wiki locally