ConversionServiceArguments Class — spring-boot Architecture
Architecture documentation for the ConversionServiceArguments class in ConversionServiceArguments.java from the spring-boot codebase.
Entity Profile
Relationship Graph
Source Code
core/spring-boot/src/test/java/org/springframework/boot/convert/ConversionServiceArguments.java lines 39–107
public final class ConversionServiceArguments {
private ConversionServiceArguments() {
}
public static Stream<? extends Arguments> with(Formatter<?> formatter) {
return with((conversionService) -> conversionService.addFormatter(formatter));
}
public static Stream<? extends Arguments> with(GenericConverter converter) {
return with((conversionService) -> conversionService.addConverter(converter));
}
public static Stream<? extends Arguments> with(Consumer<FormattingConversionService> initializer) {
FormattingConversionService withoutDefaults = new FormattingConversionService();
initializer.accept(withoutDefaults);
return Stream.of(
Arguments.of(new NamedConversionService(withoutDefaults, "Without defaults conversion service")),
Arguments.of(new NamedConversionService(new ApplicationConversionService(),
"Application conversion service")));
}
public static boolean isApplicationConversionService(ConversionService conversionService) {
if (conversionService instanceof NamedConversionService namedConversionService) {
return isApplicationConversionService(namedConversionService.delegate);
}
return conversionService instanceof ApplicationConversionService;
}
static class NamedConversionService implements ConversionService {
private final ConversionService delegate;
private final String name;
NamedConversionService(ConversionService delegate, String name) {
this.delegate = delegate;
this.name = name;
}
@Override
public boolean canConvert(@Nullable Class<?> sourceType, Class<?> targetType) {
return this.delegate.canConvert(sourceType, targetType);
}
@Override
public boolean canConvert(@Nullable TypeDescriptor sourceType, TypeDescriptor targetType) {
return this.delegate.canConvert(sourceType, targetType);
}
@Override
public <T> @Nullable T convert(@Nullable Object source, Class<T> targetType) {
return this.delegate.convert(source, targetType);
}
@Override
public @Nullable Object convert(@Nullable Object source, @Nullable TypeDescriptor sourceType,
TypeDescriptor targetType) {
return this.delegate.convert(source, sourceType, targetType);
}
@Override
public String toString() {
return this.name;
}
}
}
Domain
Source
Analyze Your Own Codebase
Get architecture documentation, dependency graphs, and domain analysis for your codebase in minutes.
Try Supermodel Free