Class ReflectiveConfigurationPropertyJSONGenerator

  • All Implemented Interfaces:
    Prioritized, ConfigurationPropertyJSONGenerator, java.lang.Comparable<Prioritized>

    public class ReflectiveConfigurationPropertyJSONGenerator
    extends java.lang.Object
    implements ConfigurationPropertyJSONGenerator
    ConfigurationPropertyJSONGenerator class based on Java Reflection API

    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"
       }
     }
     
    Since:
    1.0.0
    Author:
    Mercy
    See Also:
    ConfigurationPropertyJSONGenerator, JSONObject, BeanUtils.resolvePropertiesAsMap(Object)
    • Constructor Detail

      • ReflectiveConfigurationPropertyJSONGenerator

        public ReflectiveConfigurationPropertyJSONGenerator()
    • Method Detail