addFormatterBeanWithTypeConvertsUsingTypeInformation() — spring-boot Function Reference
Architecture documentation for the addFormatterBeanWithTypeConvertsUsingTypeInformation() function in ApplicationConversionServiceTests.java from the spring-boot codebase.
Entity Profile
Dependency Diagram
graph TD b42c680a_5157_4da3_758e_8ba395405e88["addFormatterBeanWithTypeConvertsUsingTypeInformation()"] 6fdb053e_9591_23ef_5d54_4afd4825194d["toString()"] b42c680a_5157_4da3_758e_8ba395405e88 -->|calls| 6fdb053e_9591_23ef_5d54_4afd4825194d 21b1004e_ae41_8f05_b9fc_da72398dc09c["print()"] b42c680a_5157_4da3_758e_8ba395405e88 -->|calls| 21b1004e_ae41_8f05_b9fc_da72398dc09c 67eebd91_067f_37a3_720f_be077a933fd8["parse()"] b42c680a_5157_4da3_758e_8ba395405e88 -->|calls| 67eebd91_067f_37a3_720f_be077a933fd8 3a7a6302_1e0d_3413_003b_42e4daa55ef8["convert()"] b42c680a_5157_4da3_758e_8ba395405e88 -->|calls| 3a7a6302_1e0d_3413_003b_42e4daa55ef8 style b42c680a_5157_4da3_758e_8ba395405e88 fill:#6366f1,stroke:#818cf8,color:#fff
Relationship Graph
Source Code
core/spring-boot/src/test/java/org/springframework/boot/convert/ApplicationConversionServiceTests.java lines 226–253
@Test
@SuppressWarnings("rawtypes")
void addFormatterBeanWithTypeConvertsUsingTypeInformation() {
FormattingConversionService conversionService = new FormattingConversionService();
Formatter<?> formatter = new Formatter() {
@Override
public String print(Object object, Locale locale) {
return object.toString().toUpperCase(locale);
}
@Override
public Object parse(String text, Locale locale) throws ParseException {
return new ExampleRecord(text.toString());
}
};
ApplicationConversionService.addBean(conversionService, formatter,
ResolvableType.forClassWithGenerics(Formatter.class, ExampleRecord.class));
assertThat(conversionService.convert(new ExampleRecord("test"), String.class)).isEqualTo("TEST");
assertThat(conversionService.convert("test", ExampleRecord.class)).isEqualTo(new ExampleRecord("test"));
assertThatExceptionOfType(ConverterNotFoundException.class)
.isThrownBy(() -> conversionService.convert(new OtherRecord("test"), String.class));
assertThatExceptionOfType(ConverterNotFoundException.class)
.isThrownBy(() -> conversionService.convert("test", OtherRecord.class));
assertThatIllegalArgumentException().isThrownBy(() -> conversionService.addFormatter(formatter))
.withMessageContaining("Unable to extract");
}
Domain
Subdomains
Source
Frequently Asked Questions
What does addFormatterBeanWithTypeConvertsUsingTypeInformation() do?
addFormatterBeanWithTypeConvertsUsingTypeInformation() is a function in the spring-boot codebase.
What does addFormatterBeanWithTypeConvertsUsingTypeInformation() call?
addFormatterBeanWithTypeConvertsUsingTypeInformation() calls 4 function(s): convert, parse, print, toString.
Analyze Your Own Codebase
Get architecture documentation, dependency graphs, and domain analysis for your codebase in minutes.
Try Supermodel Free