PrefixedConfigurationPropertySource Class — spring-boot Architecture
Architecture documentation for the PrefixedConfigurationPropertySource class in PrefixedConfigurationPropertySource.java from the spring-boot codebase.
Entity Profile
Source Code
core/spring-boot/src/main/java/org/springframework/boot/context/properties/source/PrefixedConfigurationPropertySource.java lines 28–73
class PrefixedConfigurationPropertySource implements ConfigurationPropertySource {
private final ConfigurationPropertySource source;
private final ConfigurationPropertyName prefix;
PrefixedConfigurationPropertySource(ConfigurationPropertySource source, String prefix) {
Assert.notNull(source, "'source' must not be null");
Assert.hasText(prefix, "'prefix' must not be empty");
this.source = source;
this.prefix = ConfigurationPropertyName.of(prefix);
}
protected final ConfigurationPropertyName getPrefix() {
return this.prefix;
}
@Override
public @Nullable ConfigurationProperty getConfigurationProperty(ConfigurationPropertyName name) {
ConfigurationProperty configurationProperty = this.source.getConfigurationProperty(getPrefixedName(name));
if (configurationProperty == null) {
return null;
}
return ConfigurationProperty.of(configurationProperty.getSource(), name, configurationProperty.getValue(),
configurationProperty.getOrigin());
}
private ConfigurationPropertyName getPrefixedName(ConfigurationPropertyName name) {
return this.prefix.append(name);
}
@Override
public ConfigurationPropertyState containsDescendantOf(ConfigurationPropertyName name) {
return this.source.containsDescendantOf(getPrefixedName(name));
}
@Override
public @Nullable Object getUnderlyingSource() {
return this.source.getUnderlyingSource();
}
protected ConfigurationPropertySource getSource() {
return this.source;
}
}
Source
Analyze Your Own Codebase
Get architecture documentation, dependency graphs, and domain analysis for your codebase in minutes.
Try Supermodel Free