write

open override fun write(out: JsonWriter, value: Optional<E>?)

Serializes an Optional value to JSON.

If the Optional is null or empty, writes a JSON null value. If the Optional contains a value, delegates to the appropriate TypeAdapter for that value type.

Parameters

out

The JsonWriter to write the serialized data to

value

The Optional value to serialize (may be null or empty)