StructuredMessage Class — spring-boot Architecture
Architecture documentation for the StructuredMessage class in StructuredMessage.java from the spring-boot codebase.
Entity Profile
Relationship Graph
Source Code
core/spring-boot/src/main/java/org/springframework/boot/logging/log4j2/StructuredMessage.java lines 31–66
final class StructuredMessage {
private static final String JSON2 = "JSON";
private static final String[] JSON = { JSON2 };
private StructuredMessage() {
}
static Object get(Message message) {
if (message instanceof MultiFormatStringBuilderFormattable multiFormatMessage
&& hasJsonFormat(multiFormatMessage)) {
return WritableJson.of((out) -> formatTo(multiFormatMessage, out));
}
return message.getFormattedMessage();
}
private static boolean hasJsonFormat(MultiFormatStringBuilderFormattable message) {
for (String format : message.getFormats()) {
if (JSON2.equalsIgnoreCase(format)) {
return true;
}
}
return false;
}
private static void formatTo(MultiFormatStringBuilderFormattable message, Appendable out) throws IOException {
if (out instanceof StringBuilder stringBuilder) {
message.formatTo(JSON, stringBuilder);
}
else {
out.append(message.getFormattedMessage(JSON));
}
}
}
Domain
Source
Analyze Your Own Codebase
Get architecture documentation, dependency graphs, and domain analysis for your codebase in minutes.
Try Supermodel Free