CountingMockPropertySource Class — spring-boot Architecture
Architecture documentation for the CountingMockPropertySource class in ConfigurationPropertySourcesPropertyResolverTests.java from the spring-boot codebase.
Entity Profile
Source Code
core/spring-boot/src/test/java/org/springframework/boot/context/properties/source/ConfigurationPropertySourcesPropertyResolverTests.java lines 164–189
static class CountingMockPropertySource extends MockPropertySource {
private final Map<String, AtomicInteger> counts = new HashMap<>();
@Override
public @Nullable Object getProperty(String name) {
incrementCount(name);
return super.getProperty(name);
}
@Override
public boolean containsProperty(String name) {
incrementCount(name);
return super.containsProperty(name);
}
private void incrementCount(String name) {
this.counts.computeIfAbsent(name, (k) -> new AtomicInteger()).incrementAndGet();
}
int getCount(String name) {
AtomicInteger count = this.counts.get(name);
return (count != null) ? count.get() : 0;
}
}
Source
Analyze Your Own Codebase
Get architecture documentation, dependency graphs, and domain analysis for your codebase in minutes.
Try Supermodel Free