getNewDefaultValueInstanceIfPossible() — spring-boot Function Reference
Architecture documentation for the getNewDefaultValueInstanceIfPossible() function in ValueObjectBinder.java from the spring-boot codebase.
Entity Profile
Dependency Diagram
graph TD 95e80a07_1395_d714_760f_30137961bf1f["getNewDefaultValueInstanceIfPossible()"] 46b98d48_2b64_2351_c50d_2fa01b9964c8["getDefaultValue()"] 46b98d48_2b64_2351_c50d_2fa01b9964c8 -->|calls| 95e80a07_1395_d714_760f_30137961bf1f 0d315f0c_db86_abaa_bc1c_ded83d4b9fee["isEmptyDefaultValueAllowed()"] 95e80a07_1395_d714_760f_30137961bf1f -->|calls| 0d315f0c_db86_abaa_bc1c_ded83d4b9fee 7aa7c7f1_53b7_c1f7_1b1c_b5d601b34a76["create()"] 95e80a07_1395_d714_760f_30137961bf1f -->|calls| 7aa7c7f1_53b7_c1f7_1b1c_b5d601b34a76 76576a77_87f7_3680_8561_2923813db3c1["of()"] 95e80a07_1395_d714_760f_30137961bf1f -->|calls| 76576a77_87f7_3680_8561_2923813db3c1 style 95e80a07_1395_d714_760f_30137961bf1f fill:#6366f1,stroke:#818cf8,color:#fff
Relationship Graph
Source Code
core/spring-boot/src/main/java/org/springframework/boot/context/properties/bind/ValueObjectBinder.java lines 153–181
@SuppressWarnings("unchecked")
private <T> @Nullable T getNewDefaultValueInstanceIfPossible(Binder.Context context, ResolvableType type) {
Class<T> resolved = (Class<T>) type.resolve();
Assert.state(resolved == null || isEmptyDefaultValueAllowed(resolved),
() -> "Parameter of type " + type + " must have a non-empty default value.");
if (resolved != null) {
if (Optional.class == resolved) {
return (T) Optional.empty();
}
if (Collection.class.isAssignableFrom(resolved)) {
return (T) CollectionFactory.createCollection(resolved, 0);
}
if (EnumMap.class.isAssignableFrom(resolved)) {
Class<?> keyType = type.asMap().resolveGeneric(0);
return (T) CollectionFactory.createMap(resolved, keyType, 0);
}
if (Map.class.isAssignableFrom(resolved)) {
return (T) CollectionFactory.createMap(resolved, 0);
}
if (resolved.isArray()) {
return (T) Array.newInstance(resolved.getComponentType(), 0);
}
}
T instance = create(Bindable.of(type), context);
if (instance != null) {
return instance;
}
return (resolved != null) ? BeanUtils.instantiateClass(resolved) : null;
}
Domain
Subdomains
Called By
Source
Frequently Asked Questions
What does getNewDefaultValueInstanceIfPossible() do?
getNewDefaultValueInstanceIfPossible() is a function in the spring-boot codebase.
What does getNewDefaultValueInstanceIfPossible() call?
getNewDefaultValueInstanceIfPossible() calls 3 function(s): create, isEmptyDefaultValueAllowed, of.
What calls getNewDefaultValueInstanceIfPossible()?
getNewDefaultValueInstanceIfPossible() is called by 1 function(s): getDefaultValue.
Analyze Your Own Codebase
Get architecture documentation, dependency graphs, and domain analysis for your codebase in minutes.
Try Supermodel Free