DefaultValueObject Class — spring-boot Architecture
Architecture documentation for the DefaultValueObject class in ValueObjectBinder.java from the spring-boot codebase.
Entity Profile
Relationship Graph
Source Code
core/spring-boot/src/main/java/org/springframework/boot/context/properties/bind/ValueObjectBinder.java lines 320–363
private static final class DefaultValueObject<T> extends ValueObject<T> {
private final List<ConstructorParameter> constructorParameters;
private DefaultValueObject(Constructor<T> constructor, List<ConstructorParameter> constructorParameters) {
super(constructor);
this.constructorParameters = constructorParameters;
}
@Override
List<ConstructorParameter> getConstructorParameters() {
return this.constructorParameters;
}
@SuppressWarnings("unchecked")
static <T> @Nullable ValueObject<T> get(Constructor<?> bindConstructor, ResolvableType type,
ParameterNameDiscoverer parameterNameDiscoverer) {
@Nullable String @Nullable [] names = parameterNameDiscoverer.getParameterNames(bindConstructor);
if (names == null) {
return null;
}
List<ConstructorParameter> constructorParameters = parseConstructorParameters(bindConstructor, type, names);
return new DefaultValueObject<>((Constructor<T>) bindConstructor, constructorParameters);
}
private static List<ConstructorParameter> parseConstructorParameters(Constructor<?> constructor,
ResolvableType type, @Nullable String[] names) {
Parameter[] parameters = constructor.getParameters();
List<ConstructorParameter> result = new ArrayList<>(parameters.length);
for (int i = 0; i < parameters.length; i++) {
String name = MergedAnnotations.from(parameters[i])
.get(Name.class)
.getValue(MergedAnnotation.VALUE, String.class)
.orElse(names[i]);
ResolvableType parameterType = ResolvableType.forMethodParameter(new MethodParameter(constructor, i),
type);
Annotation[] annotations = parameters[i].getDeclaredAnnotations();
Assert.state(name != null, "'name' must not be null");
result.add(new ConstructorParameter(name, parameterType, annotations));
}
return Collections.unmodifiableList(result);
}
}
Domain
Source
Analyze Your Own Codebase
Get architecture documentation, dependency graphs, and domain analysis for your codebase in minutes.
Try Supermodel Free