MockDurationTypeDescriptor Class — spring-boot Architecture
Architecture documentation for the MockDurationTypeDescriptor class in MockDurationTypeDescriptor.java from the spring-boot codebase.
Entity Profile
Source Code
core/spring-boot/src/test/java/org/springframework/boot/convert/MockDurationTypeDescriptor.java lines 37–60
public final class MockDurationTypeDescriptor {
private MockDurationTypeDescriptor() {
}
@SuppressWarnings({ "rawtypes", "unchecked" })
public static TypeDescriptor get(@Nullable ChronoUnit unit, @Nullable DurationStyle style) {
TypeDescriptor descriptor = mock(TypeDescriptor.class);
if (unit != null) {
DurationUnit unitAnnotation = AnnotationUtils.synthesizeAnnotation(Collections.singletonMap("value", unit),
DurationUnit.class, null);
given(descriptor.getAnnotation(DurationUnit.class)).willReturn(unitAnnotation);
}
if (style != null) {
DurationFormat formatAnnotation = AnnotationUtils
.synthesizeAnnotation(Collections.singletonMap("value", style), DurationFormat.class, null);
given(descriptor.getAnnotation(DurationFormat.class)).willReturn(formatAnnotation);
}
given(descriptor.getType()).willReturn((Class) Duration.class);
given(descriptor.getObjectType()).willReturn((Class) Duration.class);
return descriptor;
}
}
Source
Analyze Your Own Codebase
Get architecture documentation, dependency graphs, and domain analysis for your codebase in minutes.
Try Supermodel Free