Package io.microsphere.beans
Class ConfigurationProperty
- java.lang.Object
-
- io.microsphere.beans.ConfigurationProperty
-
public class ConfigurationProperty extends java.lang.ObjectConfigurationPropertyis a class that represents a configuration property with its name, type, value, default value, requirement status, description, and metadata.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"); System.out.println(property.getName()); // server.port System.out.println(property.getType()); // class java.lang.Integer System.out.println(property.getValue()); // 8080 System.out.println(property.getDefaultValue()); // 8080 System.out.println(property.isRequired()); // true System.out.println(property.getDescription()); // The port number for the server System.out.println(metadata.getSources()); // [application.properties] System.out.println(metadata.getTargets()); // [server] System.out.println(metadata.getDeclaredClass()); // com.example.ServerConfig System.out.println(metadata.getDeclaredField()); // port- Since:
- 1.0.0
- Author:
- Mercy
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description static classConfigurationProperty.MetadataThe metadata class of the Spring Configuration Property
-
Constructor Summary
Constructors Constructor Description ConfigurationProperty(java.lang.String name)ConfigurationProperty(java.lang.String name, java.lang.Class<?> type)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description booleanequals(java.lang.Object o)java.lang.ObjectgetDefaultValue()java.lang.StringgetDescription()ConfigurationProperty.MetadatagetMetadata()java.lang.StringgetName()java.lang.StringgetType()java.lang.ObjectgetValue()inthashCode()booleanisRequired()voidsetDefaultValue(java.lang.Object defaultValue)voidsetDescription(java.lang.String description)voidsetRequired(boolean required)voidsetType(java.lang.Class<?> type)voidsetType(java.lang.String type)voidsetValue(java.lang.Object value)java.lang.StringtoString()
-
-
-
Method Detail
-
getDescription
@Nonnull public java.lang.String getDescription()
-
setDescription
public void setDescription(java.lang.String description)
-
getName
@Nonnull public java.lang.String getName()
-
getType
@Nonnull public java.lang.String getType()
-
setType
public void setType(@Nonnull java.lang.Class<?> type)
-
setType
public void setType(java.lang.String type)
-
getValue
@Nullable public java.lang.Object getValue()
-
setValue
public void setValue(@Nullable java.lang.Object value)
-
getDefaultValue
@Nullable public java.lang.Object getDefaultValue()
-
setDefaultValue
public void setDefaultValue(@Nullable java.lang.Object defaultValue)
-
isRequired
public boolean isRequired()
-
setRequired
public void setRequired(boolean required)
-
getMetadata
@Nonnull public ConfigurationProperty.Metadata getMetadata()
-
equals
public final boolean equals(java.lang.Object o)
- Overrides:
equalsin classjava.lang.Object
-
hashCode
public int hashCode()
- Overrides:
hashCodein classjava.lang.Object
-
toString
public java.lang.String toString()
- Overrides:
toStringin classjava.lang.Object
-
-