Package io.microsphere.metadata
Class DefaultConfigurationPropertyGenerator
- java.lang.Object
-
- io.microsphere.metadata.DefaultConfigurationPropertyGenerator
-
- All Implemented Interfaces:
Prioritized
,ConfigurationPropertyGenerator
,java.lang.Comparable<Prioritized>
public class DefaultConfigurationPropertyGenerator extends java.lang.Object implements ConfigurationPropertyGenerator
The default implementation class ofConfigurationPropertyGenerator
.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:
ConfigurationPropertyGenerator
,ConfigurationProperty
-
-
Field Summary
-
Fields inherited from interface io.microsphere.lang.Prioritized
COMPARATOR, MAX_PRIORITY, MIN_PRIORITY, NORMAL_PRIORITY
-
-
Constructor Summary
Constructors Constructor Description DefaultConfigurationPropertyGenerator()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description java.lang.String
generate(ConfigurationProperty configurationProperty)
Generates a content of the givenConfigurationProperty
.int
getPriority()
Get the priority-
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
-
Methods inherited from interface io.microsphere.lang.Prioritized
compareTo
-
-
-
-
Method Detail
-
generate
public java.lang.String generate(ConfigurationProperty configurationProperty)
Description copied from interface:ConfigurationPropertyGenerator
Generates a content of the givenConfigurationProperty
.- Specified by:
generate
in interfaceConfigurationPropertyGenerator
- Parameters:
configurationProperty
- the configuration property to be the some content.- Returns:
- a JSON string representation of the configuration property.
-
getPriority
public int getPriority()
Description copied from interface:Prioritized
Get the priority- Specified by:
getPriority
in interfacePrioritized
- Returns:
- the default is
minimum one
-
-