Home / Class/ ExtendedWhitespaceThrowablePatternConverter Class — spring-boot Architecture

ExtendedWhitespaceThrowablePatternConverter Class — spring-boot Architecture

Architecture documentation for the ExtendedWhitespaceThrowablePatternConverter class in ExtendedWhitespaceThrowablePatternConverter.java from the spring-boot codebase.

Entity Profile

Source Code

core/spring-boot/src/main/java/org/springframework/boot/logging/log4j2/ExtendedWhitespaceThrowablePatternConverter.java lines 37–77

@Plugin(name = "ExtendedWhitespaceThrowablePatternConverter", category = PatternConverter.CATEGORY)
@ConverterKeys({ "xwEx", "xwThrowable", "xwException" })
public final class ExtendedWhitespaceThrowablePatternConverter extends LogEventPatternConverter {

	private final ExtendedThrowablePatternConverter delegate;

	private final String separator;

	private ExtendedWhitespaceThrowablePatternConverter(Configuration configuration, @Nullable String[] options) {
		super("WhitespaceExtendedThrowable", "throwable");
		this.delegate = ExtendedThrowablePatternConverter.newInstance(configuration, options);
		this.separator = this.delegate.getOptions().getSeparator();
	}

	@Override
	public void format(LogEvent event, StringBuilder buffer) {
		if (event.getThrown() != null) {
			buffer.append(this.separator);
			this.delegate.format(event, buffer);
			buffer.append(this.separator);
		}
	}

	@Override
	public boolean handlesThrowable() {
		return true;
	}

	/**
	 * Creates a new instance of the class. Required by Log4J2.
	 * @param configuration current configuration
	 * @param options pattern options, may be null. If first element is "short", only the
	 * first line of the throwable will be formatted.
	 * @return a new {@code WhitespaceThrowablePatternConverter}
	 */
	public static ExtendedWhitespaceThrowablePatternConverter newInstance(Configuration configuration,
			@Nullable String[] options) {
		return new ExtendedWhitespaceThrowablePatternConverter(configuration, options);
	}

}

Analyze Your Own Codebase

Get architecture documentation, dependency graphs, and domain analysis for your codebase in minutes.

Try Supermodel Free