MockConfigurationPropertySource Class — spring-boot Architecture
Architecture documentation for the MockConfigurationPropertySource class in MockConfigurationPropertySource.java from the spring-boot codebase.
Entity Profile
Relationship Graph
Source Code
core/spring-boot/src/test/java/org/springframework/boot/context/properties/source/MockConfigurationPropertySource.java lines 35–113
public class MockConfigurationPropertySource implements IterableConfigurationPropertySource {
private final Map<ConfigurationPropertyName, OriginTrackedValue> map = new LinkedHashMap<>();
public MockConfigurationPropertySource() {
}
public MockConfigurationPropertySource(String configurationPropertyName, Object value) {
this(configurationPropertyName, value, null);
}
public MockConfigurationPropertySource(String configurationPropertyName, Object value, @Nullable String origin) {
put(ConfigurationPropertyName.of(configurationPropertyName),
OriginTrackedValue.of(value, MockOrigin.of(origin)));
}
public MockConfigurationPropertySource(Map<String, String> configs) {
configs.forEach(this::put);
}
public void put(String name, String value) {
put(ConfigurationPropertyName.of(name), value);
}
public void put(ConfigurationPropertyName name, String value) {
put(name, OriginTrackedValue.of(value));
}
private void put(ConfigurationPropertyName name, OriginTrackedValue value) {
this.map.put(name, value);
}
public ConfigurationPropertySource nonIterable() {
return new NonIterable();
}
@Override
public Iterator<ConfigurationPropertyName> iterator() {
return this.map.keySet().iterator();
}
@Override
public Stream<ConfigurationPropertyName> stream() {
return this.map.keySet().stream();
}
@Override
public Object getUnderlyingSource() {
return this.map;
}
@Override
public @Nullable ConfigurationProperty getConfigurationProperty(ConfigurationPropertyName name) {
OriginTrackedValue result = this.map.get(name);
if (result == null) {
result = findValue(name);
}
return ConfigurationProperty.of(name, result);
}
private @Nullable OriginTrackedValue findValue(ConfigurationPropertyName name) {
return this.map.get(name);
}
private final class NonIterable implements ConfigurationPropertySource {
@Override
public Object getUnderlyingSource() {
return MockConfigurationPropertySource.this.map;
}
@Override
public @Nullable ConfigurationProperty getConfigurationProperty(ConfigurationPropertyName name) {
return MockConfigurationPropertySource.this.getConfigurationProperty(name);
}
}
}
Domain
Source
Analyze Your Own Codebase
Get architecture documentation, dependency graphs, and domain analysis for your codebase in minutes.
Try Supermodel Free