public static String formatLiteral(Object value) {
        if (value == null) {
            return "";
        } else if (value instanceof Optional) {
            Optional<?> optional = (Optional<?>) value;
            return optional.isPresent() ? formatLiteral(optional.get()) : "";
        } else {
            return String.valueOf(value);
        }
    }
Provides the default functionality for formatting literal values.

<p>This formatter is registered by default as the literal "L" formatter,
and is called in the default string "S" formatter before escaping any
characters in the string.

<ul>
    <li>{@code null}: Formatted as an empty string.</li>
    <li>Empty {@code Optional}: Formatted as an empty string.</li>
    <li>{@code Optional} with value: Formatted as the formatted value in the optional.</li>
    <li>Everything else: Formatted as the result of {@link String#valueOf}.</li>
</ul>

@param value Value to format.
@return Returns the formatted value.
smithy-utils/src/main/java/software/amazon/smithy/utils/AbstractCodeWriter.java