Package io.microsphere.beans
Class ConfigurationProperty
- java.lang.Object
-
- io.microsphere.beans.ConfigurationProperty
-
public class ConfigurationProperty extends java.lang.Object
ConfigurationProperty
is 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 class
ConfigurationProperty.Metadata
The 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 boolean
equals(java.lang.Object o)
java.lang.Object
getDefaultValue()
java.lang.String
getDescription()
ConfigurationProperty.Metadata
getMetadata()
java.lang.String
getName()
java.lang.String
getType()
java.lang.Object
getValue()
int
hashCode()
boolean
isRequired()
void
setDefaultValue(java.lang.Object defaultValue)
void
setDescription(java.lang.String description)
void
setRequired(boolean required)
void
setType(java.lang.Class<?> type)
void
setType(java.lang.String type)
void
setValue(java.lang.Object value)
java.lang.String
toString()
-
-
-
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:
equals
in classjava.lang.Object
-
hashCode
public int hashCode()
- Overrides:
hashCode
in classjava.lang.Object
-
toString
public java.lang.String toString()
- Overrides:
toString
in classjava.lang.Object
-
-