Context Class — spring-boot Architecture
Architecture documentation for the Context class in Binder.java from the spring-boot codebase.
Entity Profile
Relationship Graph
Source Code
core/spring-boot/src/main/java/org/springframework/boot/context/properties/bind/Binder.java lines 577–694
final class Context implements BindContext {
private int depth;
private final List<ConfigurationPropertySource> source = Arrays.asList((ConfigurationPropertySource) null);
private int sourcePushCount;
private final Deque<Class<?>> dataObjectBindings = new ArrayDeque<>();
private final Deque<Class<?>> constructorBindings = new ArrayDeque<>();
private @Nullable ConfigurationProperty configurationProperty;
private void increaseDepth() {
this.depth++;
}
private void decreaseDepth() {
this.depth--;
}
private <T> T withSource(@Nullable ConfigurationPropertySource source, Supplier<T> supplier) {
if (source == null) {
return supplier.get();
}
ConfigurationPropertySource previous = this.source.get(0);
this.source.set(0, source);
this.sourcePushCount++;
try {
return supplier.get();
}
finally {
this.sourcePushCount--;
this.source.set(0, previous);
}
}
private <T> @Nullable T withDataObject(Class<?> type, Supplier<@Nullable T> supplier) {
this.dataObjectBindings.push(type);
try {
return withIncreasedDepth(supplier);
}
finally {
this.dataObjectBindings.pop();
}
}
private boolean isBindingDataObject(Class<?> type) {
return this.dataObjectBindings.contains(type);
}
private <T> @Nullable T withIncreasedDepth(Supplier<@Nullable T> supplier) {
increaseDepth();
try {
return supplier.get();
}
finally {
decreaseDepth();
}
}
void setConfigurationProperty(ConfigurationProperty configurationProperty) {
this.configurationProperty = configurationProperty;
}
void clearConfigurationProperty() {
this.configurationProperty = null;
}
void pushConstructorBoundTypes(Class<?> value) {
this.constructorBindings.push(value);
}
boolean isNestedConstructorBinding() {
return !this.constructorBindings.isEmpty();
}
void popConstructorBoundTypes() {
this.constructorBindings.pop();
}
PlaceholdersResolver getPlaceholdersResolver() {
return Binder.this.placeholdersResolver;
}
BindConverter getConverter() {
return Binder.this.bindConverter;
}
Map<Object, Object> getCache() {
return Binder.this.cache;
}
@Override
public Binder getBinder() {
return Binder.this;
}
@Override
public int getDepth() {
return this.depth;
}
@Override
public Iterable<ConfigurationPropertySource> getSources() {
if (this.sourcePushCount > 0) {
return this.source;
}
return Binder.this.sources;
}
@Override
public @Nullable ConfigurationProperty getConfigurationProperty() {
return this.configurationProperty;
}
}
Domain
Source
Analyze Your Own Codebase
Get architecture documentation, dependency graphs, and domain analysis for your codebase in minutes.
Try Supermodel Free