CommonFormatters Class — spring-boot Architecture
Architecture documentation for the CommonFormatters class in StructuredLogFormatterFactory.java from the spring-boot codebase.
Entity Profile
Relationship Graph
Source Code
core/spring-boot/src/main/java/org/springframework/boot/logging/structured/StructuredLogFormatterFactory.java lines 160–184
public static class CommonFormatters<E> {
private final Map<CommonStructuredLogFormat, CommonFormatterFactory<E>> factories = new TreeMap<>();
/**
* Add the factory that should be used for the given
* {@link CommonStructuredLogFormat}.
* @param format the common structured log format
* @param factory the factory to use
*/
public void add(CommonStructuredLogFormat format, CommonFormatterFactory<E> factory) {
this.factories.put(format, factory);
}
Collection<String> getCommonNames() {
return this.factories.keySet().stream().map(CommonStructuredLogFormat::getId).toList();
}
@Nullable StructuredLogFormatter<E> get(Instantiator<?> instantiator, String format) {
CommonStructuredLogFormat commonFormat = CommonStructuredLogFormat.forId(format);
CommonFormatterFactory<E> factory = (commonFormat != null) ? this.factories.get(commonFormat) : null;
return (factory != null) ? factory.createFormatter(instantiator) : null;
}
}
Domain
Source
Analyze Your Own Codebase
Get architecture documentation, dependency graphs, and domain analysis for your codebase in minutes.
Try Supermodel Free