JavaOptionalSchema
A schema for java.util.Optional, encoded exactly like OptionalSchema.
Optional<T> means the same as Kotlin's T?, so it has the same OPTIONAL tag and the same bytes. A reader cannot tell the two apart.
Optional<Double> infers from a declared property. The raw class has no type argument, so schemaOfClass(Optional::class.java) is rejected, the same as a raw Map.
A null Optional reference is rejected, not recorded as absent. Optional is never supposed to be null, so a null there is a bug.
Parameters
T
the value type when present
valueSchema
schema used to encode the value when it is present
Properties
Functions
Link copied to clipboard
Writes the given object into the buffer.
Link copied to clipboard
Writes the whole schema definition, starting with the tag, into the buffer.